本文整理汇总了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());
}
}
}
}
}
示例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());
}
}
}
}
}
示例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());
}
}
}