當前位置: 首頁>>代碼示例>>Java>>正文


Java XStreamConverter類代碼示例

本文整理匯總了Java中com.thoughtworks.xstream.annotations.XStreamConverter的典型用法代碼示例。如果您正苦於以下問題:Java XStreamConverter類的具體用法?Java XStreamConverter怎麽用?Java XStreamConverter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XStreamConverter類屬於com.thoughtworks.xstream.annotations包,在下文中一共展示了XStreamConverter類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processConverterAnnotations

import com.thoughtworks.xstream.annotations.XStreamConverter; //導入依賴的package包/類
private void processConverterAnnotations(final Class<?> type) {
    if (converterRegistry != null) {
        final XStreamConverters convertersAnnotation = type.getAnnotation(XStreamConverters.class);
        final XStreamConverter converterAnnotation = type.getAnnotation(XStreamConverter.class);
        final List<XStreamConverter> annotations = convertersAnnotation != null ? new ArrayList<XStreamConverter>(
            Arrays.asList(convertersAnnotation.value())) : new ArrayList<XStreamConverter>();
        if (converterAnnotation != null) {
            annotations.add(converterAnnotation);
        }
        for (final XStreamConverter annotation : annotations) {
            final Converter converter = cacheConverter(annotation, converterAnnotation != null ? type : null);
            if (converter != null) {
                if (converterAnnotation != null || converter.canConvert(type)) {
                    converterRegistry.registerConverter(converter, annotation.priority());
                } else {
                    throw new InitializationException("Converter "
                        + annotation.value().getName()
                        + " cannot handle annotated class "
                        + type.getName());
                }
            }
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:AnnotationMapper.java

示例2: processConverterAnnotations

import com.thoughtworks.xstream.annotations.XStreamConverter; //導入依賴的package包/類
private void processConverterAnnotations(final Class<?> type) {
    if (converterRegistry != null) {
        final XStreamConverters convertersAnnotation = type.getAnnotation(XStreamConverters.class);
        final XStreamConverter converterAnnotation = type.getAnnotation(XStreamConverter.class);
        final List<XStreamConverter> annotations = convertersAnnotation != null
            ? new ArrayList<XStreamConverter>(Arrays.asList(convertersAnnotation.value()))
            : new ArrayList<XStreamConverter>();
        if (converterAnnotation != null) {
            annotations.add(converterAnnotation);
        }
        for (final XStreamConverter annotation : annotations) {
            final Converter converter = cacheConverter(annotation, converterAnnotation != null ? type : null);
            if (converter != null) {
                if (converterAnnotation != null || converter.canConvert(type)) {
                    converterRegistry.registerConverter(converter, annotation.priority());
                } else {
                    throw new InitializationException("Converter "
                        + annotation.value().getName()
                        + " cannot handle annotated class "
                        + type.getName());
                }
            }
        }
    }
}
 
開發者ID:x-stream,項目名稱:xstream,代碼行數:26,代碼來源:AnnotationMapper.java

示例3: processLocalConverterAnnotation

import com.thoughtworks.xstream.annotations.XStreamConverter; //導入依賴的package包/類
private void processLocalConverterAnnotation(final Field field) {
    final XStreamConverter annotation = field.getAnnotation(XStreamConverter.class);
    if (annotation != null) {
        final Converter converter = cacheConverter(annotation, field.getType());
        if (converter != null) {
            if (localConversionMapper == null) {
                throw new InitializationException("No " + LocalConversionMapper.class.getName() + " available");
            }
            localConversionMapper.registerLocalConverter(field.getDeclaringClass(), field.getName(), converter);
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:AnnotationMapper.java

示例4: processConverterAnnotations

import com.thoughtworks.xstream.annotations.XStreamConverter; //導入依賴的package包/類
private void processConverterAnnotations(Class<?> paramClass)
{
  if (this.converterRegistry != null)
  {
    XStreamConverters localXStreamConverters = (XStreamConverters)paramClass.getAnnotation(XStreamConverters.class);
    XStreamConverter localXStreamConverter1 = (XStreamConverter)paramClass.getAnnotation(XStreamConverter.class);
    ArrayList localArrayList1;
    if (localXStreamConverters != null)
      localArrayList1 = new ArrayList(Arrays.asList(localXStreamConverters.value()));
    else
      localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = localArrayList1;
    if (localXStreamConverter1 != null)
      localArrayList2.add(localXStreamConverter1);
    Iterator localIterator = localArrayList2.iterator();
    while (localIterator.hasNext())
    {
      XStreamConverter localXStreamConverter2 = (XStreamConverter)localIterator.next();
      Class<?> localClass;
      if (localXStreamConverter1 != null)
        localClass = paramClass;
      else
        localClass = null;
      Converter localConverter = cacheConverter(localXStreamConverter2, localClass);
      if (localConverter != null)
        if ((localXStreamConverter1 != null) || (localConverter.canConvert(paramClass)))
          this.converterRegistry.registerConverter(localConverter, localXStreamConverter2.priority());
        else
          throw new InitializationException("Converter " + localXStreamConverter2.value().getName() + " cannot handle annotated class " + paramClass.getName());
    }
  }
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:33,代碼來源:AnnotationMapper.java

示例5: processLocalConverterAnnotation

import com.thoughtworks.xstream.annotations.XStreamConverter; //導入依賴的package包/類
private void processLocalConverterAnnotation(Field paramField)
{
  XStreamConverter localXStreamConverter = (XStreamConverter)paramField.getAnnotation(XStreamConverter.class);
  if (localXStreamConverter != null)
  {
    Converter localConverter = cacheConverter(localXStreamConverter, paramField.getType());
    if (localConverter != null)
    {
      if (this.localConversionMapper == null)
        throw new InitializationException("No " + LocalConversionMapper.class.getName() + " available");
      this.localConversionMapper.registerLocalConverter(paramField.getDeclaringClass(), paramField.getName(), localConverter);
    }
  }
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:15,代碼來源:AnnotationMapper.java


注:本文中的com.thoughtworks.xstream.annotations.XStreamConverter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。