当前位置: 首页>>代码示例>>Java>>正文


Java XStreamConverters类代码示例

本文整理汇总了Java中com.thoughtworks.xstream.annotations.XStreamConverters的典型用法代码示例。如果您正苦于以下问题:Java XStreamConverters类的具体用法?Java XStreamConverters怎么用?Java XStreamConverters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XStreamConverters类属于com.thoughtworks.xstream.annotations包,在下文中一共展示了XStreamConverters类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processConverterAnnotations

import com.thoughtworks.xstream.annotations.XStreamConverters; //导入依赖的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.XStreamConverters; //导入依赖的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: processConverterAnnotations

import com.thoughtworks.xstream.annotations.XStreamConverters; //导入依赖的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


注:本文中的com.thoughtworks.xstream.annotations.XStreamConverters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。