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