Initial commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public class AnnotationProvider {
|
||||
@Deprecated
|
||||
public <T extends Annotation> T getAnnotation(Field field, Class<T> cls) {
|
||||
return (T) field.getAnnotation(cls);
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import com.thoughtworks.xstream.converters.Converter;
|
||||
import com.thoughtworks.xstream.converters.ConverterMatcher;
|
||||
import com.thoughtworks.xstream.converters.MarshallingContext;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverterWrapper;
|
||||
import com.thoughtworks.xstream.converters.UnmarshallingContext;
|
||||
import com.thoughtworks.xstream.converters.reflection.ObjectAccessException;
|
||||
import com.thoughtworks.xstream.converters.reflection.ReflectionConverter;
|
||||
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
|
||||
import com.thoughtworks.xstream.mapper.Mapper;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public class AnnotationReflectionConverter extends ReflectionConverter {
|
||||
private final AnnotationProvider annotationProvider;
|
||||
private final Map<Class<? extends ConverterMatcher>, Converter> cachedConverters;
|
||||
|
||||
@Deprecated
|
||||
public AnnotationReflectionConverter(Mapper mapper, ReflectionProvider reflectionProvider, AnnotationProvider annotationProvider) {
|
||||
super(mapper, reflectionProvider);
|
||||
this.annotationProvider = annotationProvider;
|
||||
this.cachedConverters = new HashMap();
|
||||
}
|
||||
|
||||
private void ensureCache(Class<? extends ConverterMatcher> cls) {
|
||||
if (this.cachedConverters.containsKey(cls)) {
|
||||
return;
|
||||
}
|
||||
this.cachedConverters.put(cls, newInstance(cls));
|
||||
}
|
||||
|
||||
private Converter newInstance(Class<? extends ConverterMatcher> cls) {
|
||||
try {
|
||||
return SingleValueConverter.class.isAssignableFrom(cls) ? new SingleValueConverterWrapper((SingleValueConverter) cls.getConstructor(new Class[0]).newInstance(new Object[0])) : (Converter) cls.getConstructor(new Class[0]).newInstance(new Object[0]);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new ObjectAccessException("Cannot construct " + cls.getName(), e);
|
||||
} catch (InstantiationException e2) {
|
||||
throw new ObjectAccessException("Cannot construct " + cls.getName(), e2);
|
||||
} catch (NoSuchMethodException e3) {
|
||||
throw new ObjectAccessException("Cannot construct " + cls.getName(), e3);
|
||||
} catch (InvocationTargetException e4) {
|
||||
throw new ObjectAccessException("Cannot construct " + cls.getName(), e4.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
|
||||
protected void marshallField(MarshallingContext marshallingContext, Object obj, Field field) {
|
||||
XStreamConverter xStreamConverter = (XStreamConverter) this.annotationProvider.getAnnotation(field, XStreamConverter.class);
|
||||
if (xStreamConverter == null) {
|
||||
marshallingContext.convertAnother(obj);
|
||||
return;
|
||||
}
|
||||
Class<? extends ConverterMatcher> value = xStreamConverter.value();
|
||||
ensureCache(value);
|
||||
marshallingContext.convertAnother(obj, this.cachedConverters.get(value));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter
|
||||
protected Object unmarshallField(UnmarshallingContext unmarshallingContext, Object obj, Class cls, Field field) {
|
||||
XStreamConverter xStreamConverter = (XStreamConverter) this.annotationProvider.getAnnotation(field, XStreamConverter.class);
|
||||
if (xStreamConverter == null) {
|
||||
return unmarshallingContext.convertAnother(obj, cls);
|
||||
}
|
||||
Class<? extends ConverterMatcher> value = xStreamConverter.value();
|
||||
ensureCache(value);
|
||||
return unmarshallingContext.convertAnother(obj, cls, this.cachedConverters.get(value));
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public class Annotations {
|
||||
private Annotations() {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static synchronized void configureAliases(XStream xStream, Class<?>... clsArr) {
|
||||
synchronized (Annotations.class) {
|
||||
xStream.processAnnotations(clsArr);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamAlias {
|
||||
Class<?> impl() default Void.class;
|
||||
|
||||
String value();
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamAliasType {
|
||||
String value();
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamAsAttribute {
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamContainedType {
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import com.thoughtworks.xstream.converters.ConverterMatcher;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE, ElementType.FIELD})
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamConverter {
|
||||
boolean[] booleans() default {};
|
||||
|
||||
byte[] bytes() default {};
|
||||
|
||||
char[] chars() default {};
|
||||
|
||||
double[] doubles() default {};
|
||||
|
||||
float[] floats() default {};
|
||||
|
||||
int[] ints() default {};
|
||||
|
||||
long[] longs() default {};
|
||||
|
||||
Class<?>[] nulls() default {};
|
||||
|
||||
int priority() default 0;
|
||||
|
||||
short[] shorts() default {};
|
||||
|
||||
String[] strings() default {};
|
||||
|
||||
Class<?>[] types() default {};
|
||||
|
||||
boolean useImplicitType() default true;
|
||||
|
||||
Class<? extends ConverterMatcher> value();
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamConverters {
|
||||
XStreamConverter[] value();
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamImplicit {
|
||||
String itemFieldName() default "";
|
||||
|
||||
String keyFieldName() default "";
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamImplicitCollection {
|
||||
String item() default "";
|
||||
|
||||
String value();
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamInclude {
|
||||
Class<?>[] value();
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package com.thoughtworks.xstream.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes.dex */
|
||||
public @interface XStreamOmitField {
|
||||
}
|
Reference in New Issue
Block a user