Initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractAttributeAliasingMapper extends MapperWrapper {
|
||||
protected final Map aliasToName;
|
||||
protected transient Map nameToAlias;
|
||||
|
||||
public AbstractAttributeAliasingMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.aliasToName = new HashMap();
|
||||
this.nameToAlias = new HashMap();
|
||||
}
|
||||
|
||||
public void addAliasFor(String str, String str2) {
|
||||
this.aliasToName.put(str2, str);
|
||||
this.nameToAlias.put(str, str2);
|
||||
}
|
||||
|
||||
Object readResolve() {
|
||||
this.nameToAlias = new HashMap();
|
||||
for (Object obj : this.aliasToName.keySet()) {
|
||||
this.nameToAlias.put(this.aliasToName.get(obj), obj);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,78 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AbstractXmlFriendlyMapper extends MapperWrapper {
|
||||
private char dollarReplacementInClass;
|
||||
private String dollarReplacementInField;
|
||||
private String noPackagePrefix;
|
||||
private String underscoreReplacementInField;
|
||||
|
||||
protected AbstractXmlFriendlyMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.dollarReplacementInClass = '-';
|
||||
this.dollarReplacementInField = "_DOLLAR_";
|
||||
this.underscoreReplacementInField = "__";
|
||||
this.noPackagePrefix = "default";
|
||||
}
|
||||
|
||||
private boolean stringFoundAt(String str, int i, String str2) {
|
||||
return str.length() >= str2.length() + i && str.substring(i, str2.length() + i).equals(str2);
|
||||
}
|
||||
|
||||
protected String escapeClassName(String str) {
|
||||
String replace = str.replace('$', this.dollarReplacementInClass);
|
||||
if (replace.charAt(0) != this.dollarReplacementInClass) {
|
||||
return replace;
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(this.noPackagePrefix);
|
||||
stringBuffer.append(replace);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
protected String escapeFieldName(String str) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int length = str.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
char charAt = str.charAt(i);
|
||||
if (charAt == '$') {
|
||||
stringBuffer.append(this.dollarReplacementInField);
|
||||
} else if (charAt == '_') {
|
||||
stringBuffer.append(this.underscoreReplacementInField);
|
||||
} else {
|
||||
stringBuffer.append(charAt);
|
||||
}
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
protected String unescapeClassName(String str) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(this.noPackagePrefix);
|
||||
stringBuffer.append(this.dollarReplacementInClass);
|
||||
if (str.startsWith(stringBuffer.toString())) {
|
||||
str = str.substring(this.noPackagePrefix.length());
|
||||
}
|
||||
return str.replace(this.dollarReplacementInClass, '$');
|
||||
}
|
||||
|
||||
protected String unescapeFieldName(String str) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int length = str.length();
|
||||
int i = 0;
|
||||
while (i < length) {
|
||||
char charAt = str.charAt(i);
|
||||
if (stringFoundAt(str, i, this.underscoreReplacementInField)) {
|
||||
i += this.underscoreReplacementInField.length() - 1;
|
||||
stringBuffer.append('_');
|
||||
} else if (stringFoundAt(str, i, this.dollarReplacementInField)) {
|
||||
i += this.dollarReplacementInField.length() - 1;
|
||||
stringBuffer.append('$');
|
||||
} else {
|
||||
stringBuffer.append(charAt);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface AnnotationConfiguration {
|
||||
void autodetectAnnotations(boolean z);
|
||||
|
||||
void processAnnotations(Class[] clsArr);
|
||||
}
|
595
sources/com/thoughtworks/xstream/mapper/AnnotationMapper.java
Normal file
595
sources/com/thoughtworks/xstream/mapper/AnnotationMapper.java
Normal file
@@ -0,0 +1,595 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.InitializationException;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAliasType;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverters;
|
||||
import com.thoughtworks.xstream.annotations.XStreamImplicitCollection;
|
||||
import com.thoughtworks.xstream.annotations.XStreamInclude;
|
||||
import com.thoughtworks.xstream.annotations.XStreamOmitField;
|
||||
import com.thoughtworks.xstream.converters.Converter;
|
||||
import com.thoughtworks.xstream.converters.ConverterLookup;
|
||||
import com.thoughtworks.xstream.converters.ConverterMatcher;
|
||||
import com.thoughtworks.xstream.converters.ConverterRegistry;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverterWrapper;
|
||||
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
|
||||
import com.thoughtworks.xstream.core.ClassLoaderReference;
|
||||
import com.thoughtworks.xstream.core.JVM;
|
||||
import com.thoughtworks.xstream.core.util.DependencyInjectionFactory;
|
||||
import com.thoughtworks.xstream.core.util.TypedNull;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.GenericArrayType;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.lang.reflect.TypeVariable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AnnotationMapper extends MapperWrapper implements AnnotationConfiguration {
|
||||
private final Set<Class<?>> annotatedTypes;
|
||||
private transient Object[] arguments;
|
||||
private transient AttributeMapper attributeMapper;
|
||||
private transient ClassAliasingMapper classAliasingMapper;
|
||||
private final Map<Class<?>, Map<List<Object>, Converter>> converterCache;
|
||||
private final ConverterRegistry converterRegistry;
|
||||
private transient DefaultImplementationsMapper defaultImplementationsMapper;
|
||||
private transient ElementIgnoringMapper elementIgnoringMapper;
|
||||
private transient FieldAliasingMapper fieldAliasingMapper;
|
||||
private transient ImplicitCollectionMapper implicitCollectionMapper;
|
||||
private transient LocalConversionMapper localConversionMapper;
|
||||
private boolean locked;
|
||||
|
||||
private final class UnprocessedTypesSet extends LinkedHashSet<Class<?>> {
|
||||
private UnprocessedTypesSet() {
|
||||
}
|
||||
|
||||
@Override // java.util.HashSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
||||
public boolean add(Class<?> cls) {
|
||||
XStreamInclude xStreamInclude;
|
||||
Class<?>[] value;
|
||||
if (cls == null) {
|
||||
return false;
|
||||
}
|
||||
while (cls.isArray()) {
|
||||
cls = cls.getComponentType();
|
||||
}
|
||||
String name = cls.getName();
|
||||
if (name.startsWith("java.") || name.startsWith("javax.")) {
|
||||
return false;
|
||||
}
|
||||
boolean add = AnnotationMapper.this.annotatedTypes.contains(cls) ? false : super.add((UnprocessedTypesSet) cls);
|
||||
if (add && (xStreamInclude = (XStreamInclude) cls.getAnnotation(XStreamInclude.class)) != null && (value = xStreamInclude.value()) != null) {
|
||||
for (Class<?> cls2 : value) {
|
||||
add(cls2);
|
||||
}
|
||||
}
|
||||
return add;
|
||||
}
|
||||
}
|
||||
|
||||
public AnnotationMapper(Mapper mapper, ConverterRegistry converterRegistry, ConverterLookup converterLookup, ClassLoaderReference classLoaderReference, ReflectionProvider reflectionProvider) {
|
||||
super(mapper);
|
||||
this.converterCache = new HashMap();
|
||||
this.annotatedTypes = Collections.synchronizedSet(new HashSet());
|
||||
this.converterRegistry = converterRegistry;
|
||||
this.annotatedTypes.add(Object.class);
|
||||
setupMappers();
|
||||
this.locked = true;
|
||||
Object reference = classLoaderReference.getReference();
|
||||
Object[] objArr = new Object[6];
|
||||
objArr[0] = this;
|
||||
objArr[1] = classLoaderReference;
|
||||
objArr[2] = reflectionProvider;
|
||||
objArr[3] = converterLookup;
|
||||
objArr[4] = new JVM();
|
||||
objArr[5] = reference == null ? new TypedNull(ClassLoader.class) : reference;
|
||||
this.arguments = objArr;
|
||||
}
|
||||
|
||||
private void addParametrizedTypes(Type type, final Set<Class<?>> set) {
|
||||
final HashSet hashSet = new HashSet();
|
||||
LinkedHashSet<Type> linkedHashSet = new LinkedHashSet<Type>() { // from class: com.thoughtworks.xstream.mapper.AnnotationMapper.1
|
||||
@Override // java.util.HashSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
||||
public boolean add(Type type2) {
|
||||
if (type2 instanceof Class) {
|
||||
return set.add((Class) type2);
|
||||
}
|
||||
if (type2 == null || hashSet.contains(type2)) {
|
||||
return false;
|
||||
}
|
||||
return super.add((AnonymousClass1) type2);
|
||||
}
|
||||
};
|
||||
while (type != null) {
|
||||
hashSet.add(type);
|
||||
int i = 0;
|
||||
if (type instanceof Class) {
|
||||
Class<?> cls = (Class) type;
|
||||
set.add(cls);
|
||||
if (!cls.isPrimitive()) {
|
||||
for (TypeVariable<Class<?>> typeVariable : cls.getTypeParameters()) {
|
||||
linkedHashSet.add(typeVariable);
|
||||
}
|
||||
linkedHashSet.add(cls.getGenericSuperclass());
|
||||
Type[] genericInterfaces = cls.getGenericInterfaces();
|
||||
int length = genericInterfaces.length;
|
||||
while (i < length) {
|
||||
linkedHashSet.add(genericInterfaces[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
} else if (type instanceof TypeVariable) {
|
||||
Type[] bounds = ((TypeVariable) type).getBounds();
|
||||
int length2 = bounds.length;
|
||||
while (i < length2) {
|
||||
linkedHashSet.add(bounds[i]);
|
||||
i++;
|
||||
}
|
||||
} else if (type instanceof ParameterizedType) {
|
||||
ParameterizedType parameterizedType = (ParameterizedType) type;
|
||||
linkedHashSet.add(parameterizedType.getRawType());
|
||||
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
|
||||
int length3 = actualTypeArguments.length;
|
||||
while (i < length3) {
|
||||
linkedHashSet.add(actualTypeArguments[i]);
|
||||
i++;
|
||||
}
|
||||
} else if (type instanceof GenericArrayType) {
|
||||
linkedHashSet.add(((GenericArrayType) type).getGenericComponentType());
|
||||
}
|
||||
if (linkedHashSet.isEmpty()) {
|
||||
type = null;
|
||||
} else {
|
||||
Iterator<Type> it = linkedHashSet.iterator();
|
||||
Type next = it.next();
|
||||
it.remove();
|
||||
type = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Converter cacheConverter(XStreamConverter xStreamConverter, Class cls) {
|
||||
Object[] objArr;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (cls != null && xStreamConverter.useImplicitType()) {
|
||||
arrayList.add(cls);
|
||||
}
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
arrayList2.add(xStreamConverter.booleans());
|
||||
arrayList2.add(xStreamConverter.bytes());
|
||||
arrayList2.add(xStreamConverter.chars());
|
||||
arrayList2.add(xStreamConverter.doubles());
|
||||
arrayList2.add(xStreamConverter.floats());
|
||||
arrayList2.add(xStreamConverter.ints());
|
||||
arrayList2.add(xStreamConverter.longs());
|
||||
arrayList2.add(xStreamConverter.shorts());
|
||||
arrayList2.add(xStreamConverter.strings());
|
||||
arrayList2.add(xStreamConverter.types());
|
||||
Iterator it = arrayList2.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
Object next = it.next();
|
||||
if (next != null) {
|
||||
int length = Array.getLength(next);
|
||||
for (int i = 0; i < length; i++) {
|
||||
arrayList.add(Array.get(next, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Class<?> cls2 : xStreamConverter.nulls()) {
|
||||
arrayList.add(new TypedNull(cls2));
|
||||
}
|
||||
Class<? extends ConverterMatcher> value = xStreamConverter.value();
|
||||
Map<List<Object>, Converter> map = this.converterCache.get(value);
|
||||
Converter converter = map != null ? map.get(arrayList) : null;
|
||||
if (converter == null) {
|
||||
int size = arrayList.size();
|
||||
if (size > 0) {
|
||||
Object[] objArr2 = this.arguments;
|
||||
objArr = new Object[objArr2.length + size];
|
||||
System.arraycopy(objArr2, 0, objArr, size, objArr2.length);
|
||||
System.arraycopy(arrayList.toArray(new Object[size]), 0, objArr, 0, size);
|
||||
} else {
|
||||
objArr = this.arguments;
|
||||
}
|
||||
try {
|
||||
converter = (!SingleValueConverter.class.isAssignableFrom(value) || Converter.class.isAssignableFrom(value)) ? (Converter) DependencyInjectionFactory.newInstance(value, objArr) : new SingleValueConverterWrapper((SingleValueConverter) DependencyInjectionFactory.newInstance(value, objArr));
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
this.converterCache.put(value, map);
|
||||
}
|
||||
map.put(arrayList, converter);
|
||||
} catch (Exception e) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Cannot instantiate converter ");
|
||||
sb.append(value.getName());
|
||||
sb.append(cls != null ? " for type " + cls.getName() : "");
|
||||
throw new InitializationException(sb.toString(), e);
|
||||
}
|
||||
}
|
||||
return converter;
|
||||
}
|
||||
|
||||
private Class<?> getClass(Type type) {
|
||||
if (type instanceof ParameterizedType) {
|
||||
return (Class) ((ParameterizedType) type).getRawType();
|
||||
}
|
||||
if (type instanceof Class) {
|
||||
return (Class) type;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void processAliasAnnotation(Class<?> cls, Set<Class<?>> set) {
|
||||
XStreamAlias xStreamAlias = (XStreamAlias) cls.getAnnotation(XStreamAlias.class);
|
||||
if (xStreamAlias != null) {
|
||||
ClassAliasingMapper classAliasingMapper = this.classAliasingMapper;
|
||||
if (classAliasingMapper == null) {
|
||||
throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available");
|
||||
}
|
||||
classAliasingMapper.addClassAlias(xStreamAlias.value(), cls);
|
||||
if (xStreamAlias.impl() != Void.class) {
|
||||
this.defaultImplementationsMapper.addDefaultImplementation(xStreamAlias.impl(), cls);
|
||||
if (cls.isInterface()) {
|
||||
set.add(xStreamAlias.impl());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processAliasTypeAnnotation(Class<?> cls) {
|
||||
XStreamAliasType xStreamAliasType = (XStreamAliasType) cls.getAnnotation(XStreamAliasType.class);
|
||||
if (xStreamAliasType != null) {
|
||||
ClassAliasingMapper classAliasingMapper = this.classAliasingMapper;
|
||||
if (classAliasingMapper != null) {
|
||||
classAliasingMapper.addTypeAlias(xStreamAliasType.value(), cls);
|
||||
return;
|
||||
}
|
||||
throw new InitializationException("No " + ClassAliasingMapper.class.getName() + " available");
|
||||
}
|
||||
}
|
||||
|
||||
private void processAsAttributeAnnotation(Field field) {
|
||||
if (((XStreamAsAttribute) field.getAnnotation(XStreamAsAttribute.class)) != null) {
|
||||
AttributeMapper attributeMapper = this.attributeMapper;
|
||||
if (attributeMapper != null) {
|
||||
attributeMapper.addAttributeFor(field);
|
||||
return;
|
||||
}
|
||||
throw new InitializationException("No " + AttributeMapper.class.getName() + " available");
|
||||
}
|
||||
}
|
||||
|
||||
private void processConverterAnnotations(Class<?> cls) {
|
||||
if (this.converterRegistry != null) {
|
||||
XStreamConverters xStreamConverters = (XStreamConverters) cls.getAnnotation(XStreamConverters.class);
|
||||
XStreamConverter xStreamConverter = (XStreamConverter) cls.getAnnotation(XStreamConverter.class);
|
||||
ArrayList<XStreamConverter> arrayList = xStreamConverters != null ? new ArrayList(Arrays.asList(xStreamConverters.value())) : new ArrayList();
|
||||
if (xStreamConverter != null) {
|
||||
arrayList.add(xStreamConverter);
|
||||
}
|
||||
for (XStreamConverter xStreamConverter2 : arrayList) {
|
||||
Converter cacheConverter = cacheConverter(xStreamConverter2, xStreamConverter != null ? cls : null);
|
||||
if (cacheConverter != null) {
|
||||
if (xStreamConverter == null && !cacheConverter.canConvert(cls)) {
|
||||
throw new InitializationException("Converter " + xStreamConverter2.value().getName() + " cannot handle annotated class " + cls.getName());
|
||||
}
|
||||
this.converterRegistry.registerConverter(cacheConverter, xStreamConverter2.priority());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processFieldAliasAnnotation(Field field) {
|
||||
XStreamAlias xStreamAlias = (XStreamAlias) field.getAnnotation(XStreamAlias.class);
|
||||
if (xStreamAlias != null) {
|
||||
FieldAliasingMapper fieldAliasingMapper = this.fieldAliasingMapper;
|
||||
if (fieldAliasingMapper != null) {
|
||||
fieldAliasingMapper.addFieldAlias(xStreamAlias.value(), field.getDeclaringClass(), field.getName());
|
||||
return;
|
||||
}
|
||||
throw new InitializationException("No " + FieldAliasingMapper.class.getName() + " available");
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:12:0x004a */
|
||||
/* JADX WARN: Removed duplicated region for block: B:25:0x006b */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private void processImplicitAnnotation(java.lang.reflect.Field r9) {
|
||||
/*
|
||||
r8 = this;
|
||||
java.lang.Class<com.thoughtworks.xstream.annotations.XStreamImplicit> r0 = com.thoughtworks.xstream.annotations.XStreamImplicit.class
|
||||
java.lang.annotation.Annotation r0 = r9.getAnnotation(r0)
|
||||
com.thoughtworks.xstream.annotations.XStreamImplicit r0 = (com.thoughtworks.xstream.annotations.XStreamImplicit) r0
|
||||
if (r0 == 0) goto La9
|
||||
com.thoughtworks.xstream.mapper.ImplicitCollectionMapper r1 = r8.implicitCollectionMapper
|
||||
if (r1 == 0) goto L87
|
||||
java.lang.String r4 = r9.getName()
|
||||
java.lang.String r1 = r0.itemFieldName()
|
||||
java.lang.String r0 = r0.keyFieldName()
|
||||
java.lang.Class<java.util.Map> r2 = java.util.Map.class
|
||||
java.lang.Class r3 = r9.getType()
|
||||
boolean r2 = r2.isAssignableFrom(r3)
|
||||
java.lang.Class r3 = r9.getType()
|
||||
boolean r3 = r3.isArray()
|
||||
r5 = 0
|
||||
if (r3 != 0) goto L45
|
||||
java.lang.reflect.Type r3 = r9.getGenericType()
|
||||
boolean r6 = r3 instanceof java.lang.reflect.ParameterizedType
|
||||
if (r6 == 0) goto L45
|
||||
java.lang.reflect.ParameterizedType r3 = (java.lang.reflect.ParameterizedType) r3
|
||||
java.lang.reflect.Type[] r3 = r3.getActualTypeArguments()
|
||||
r3 = r3[r2]
|
||||
java.lang.Class r3 = r8.getClass(r3)
|
||||
r6 = r3
|
||||
goto L46
|
||||
L45:
|
||||
r6 = r5
|
||||
L46:
|
||||
java.lang.String r3 = ""
|
||||
if (r2 == 0) goto L6b
|
||||
com.thoughtworks.xstream.mapper.ImplicitCollectionMapper r2 = r8.implicitCollectionMapper
|
||||
java.lang.Class r9 = r9.getDeclaringClass()
|
||||
if (r1 == 0) goto L59
|
||||
boolean r7 = r3.equals(r1)
|
||||
if (r7 != 0) goto L59
|
||||
goto L5a
|
||||
L59:
|
||||
r1 = r5
|
||||
L5a:
|
||||
if (r0 == 0) goto L64
|
||||
boolean r3 = r3.equals(r0)
|
||||
if (r3 != 0) goto L64
|
||||
r7 = r0
|
||||
goto L65
|
||||
L64:
|
||||
r7 = r5
|
||||
L65:
|
||||
r3 = r9
|
||||
r5 = r1
|
||||
r2.add(r3, r4, r5, r6, r7)
|
||||
goto La9
|
||||
L6b:
|
||||
if (r1 == 0) goto L7d
|
||||
boolean r0 = r3.equals(r1)
|
||||
if (r0 != 0) goto L7d
|
||||
com.thoughtworks.xstream.mapper.ImplicitCollectionMapper r0 = r8.implicitCollectionMapper
|
||||
java.lang.Class r9 = r9.getDeclaringClass()
|
||||
r0.add(r9, r4, r1, r6)
|
||||
goto La9
|
||||
L7d:
|
||||
com.thoughtworks.xstream.mapper.ImplicitCollectionMapper r0 = r8.implicitCollectionMapper
|
||||
java.lang.Class r9 = r9.getDeclaringClass()
|
||||
r0.add(r9, r4, r6)
|
||||
goto La9
|
||||
L87:
|
||||
com.thoughtworks.xstream.InitializationException r9 = new com.thoughtworks.xstream.InitializationException
|
||||
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
||||
r0.<init>()
|
||||
java.lang.String r1 = "No "
|
||||
r0.append(r1)
|
||||
java.lang.Class<com.thoughtworks.xstream.mapper.ImplicitCollectionMapper> r1 = com.thoughtworks.xstream.mapper.ImplicitCollectionMapper.class
|
||||
java.lang.String r1 = r1.getName()
|
||||
r0.append(r1)
|
||||
java.lang.String r1 = " available"
|
||||
r0.append(r1)
|
||||
java.lang.String r0 = r0.toString()
|
||||
r9.<init>(r0)
|
||||
throw r9
|
||||
La9:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.thoughtworks.xstream.mapper.AnnotationMapper.processImplicitAnnotation(java.lang.reflect.Field):void");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void processImplicitCollectionAnnotation(Class<?> cls) {
|
||||
XStreamImplicitCollection xStreamImplicitCollection = (XStreamImplicitCollection) cls.getAnnotation(XStreamImplicitCollection.class);
|
||||
if (xStreamImplicitCollection != null) {
|
||||
if (this.implicitCollectionMapper == null) {
|
||||
throw new InitializationException("No " + ImplicitCollectionMapper.class.getName() + " available");
|
||||
}
|
||||
String value = xStreamImplicitCollection.value();
|
||||
String item = xStreamImplicitCollection.item();
|
||||
try {
|
||||
Type genericType = cls.getDeclaredField(value).getGenericType();
|
||||
Class<?> cls2 = genericType instanceof ParameterizedType ? getClass(((ParameterizedType) genericType).getActualTypeArguments()[0]) : null;
|
||||
if (cls2 == null) {
|
||||
this.implicitCollectionMapper.add(cls, value, null, Object.class);
|
||||
} else if (item.equals("")) {
|
||||
this.implicitCollectionMapper.add(cls, value, null, cls2);
|
||||
} else {
|
||||
this.implicitCollectionMapper.add(cls, value, item, cls2);
|
||||
}
|
||||
} catch (NoSuchFieldException unused) {
|
||||
throw new InitializationException(cls.getName() + " does not have a field named '" + value + "' as required by " + XStreamImplicitCollection.class.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processLocalConverterAnnotation(Field field) {
|
||||
Converter cacheConverter;
|
||||
XStreamConverter xStreamConverter = (XStreamConverter) field.getAnnotation(XStreamConverter.class);
|
||||
if (xStreamConverter == null || (cacheConverter = cacheConverter(xStreamConverter, field.getType())) == null) {
|
||||
return;
|
||||
}
|
||||
LocalConversionMapper localConversionMapper = this.localConversionMapper;
|
||||
if (localConversionMapper != null) {
|
||||
localConversionMapper.registerLocalConverter(field.getDeclaringClass(), field.getName(), cacheConverter);
|
||||
return;
|
||||
}
|
||||
throw new InitializationException("No " + LocalConversionMapper.class.getName() + " available");
|
||||
}
|
||||
|
||||
private void processOmitFieldAnnotation(Field field) {
|
||||
if (((XStreamOmitField) field.getAnnotation(XStreamOmitField.class)) != null) {
|
||||
ElementIgnoringMapper elementIgnoringMapper = this.elementIgnoringMapper;
|
||||
if (elementIgnoringMapper != null) {
|
||||
elementIgnoringMapper.omitField(field.getDeclaringClass(), field.getName());
|
||||
return;
|
||||
}
|
||||
throw new InitializationException("No " + ElementIgnoringMapper.class.getName() + " available");
|
||||
}
|
||||
}
|
||||
|
||||
private void processTypes(Set<Class<?>> set) {
|
||||
while (!set.isEmpty()) {
|
||||
Iterator<Class<?>> it = set.iterator();
|
||||
Class<?> next = it.next();
|
||||
it.remove();
|
||||
synchronized (next) {
|
||||
if (!this.annotatedTypes.contains(next)) {
|
||||
try {
|
||||
if (!next.isPrimitive()) {
|
||||
addParametrizedTypes(next, set);
|
||||
processConverterAnnotations(next);
|
||||
processAliasAnnotation(next, set);
|
||||
processAliasTypeAnnotation(next);
|
||||
if (next.isInterface()) {
|
||||
this.annotatedTypes.add(next);
|
||||
} else {
|
||||
processImplicitCollectionAnnotation(next);
|
||||
for (Field field : next.getDeclaredFields()) {
|
||||
if (!field.isEnumConstant() && (field.getModifiers() & 136) <= 0) {
|
||||
addParametrizedTypes(field.getGenericType(), set);
|
||||
if (!field.isSynthetic()) {
|
||||
processFieldAliasAnnotation(field);
|
||||
processAsAttributeAnnotation(field);
|
||||
processImplicitAnnotation(field);
|
||||
processOmitFieldAnnotation(field);
|
||||
processLocalConverterAnnotation(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.annotatedTypes.add(next);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
||||
objectInputStream.defaultReadObject();
|
||||
setupMappers();
|
||||
int readInt = objectInputStream.readInt();
|
||||
this.arguments = new Object[readInt + 2];
|
||||
for (int i = 0; i < readInt; i++) {
|
||||
this.arguments[i] = objectInputStream.readObject();
|
||||
Object[] objArr = this.arguments;
|
||||
if (objArr[i] instanceof ClassLoaderReference) {
|
||||
objArr[readInt + 1] = ((ClassLoaderReference) objArr[i]).getReference();
|
||||
}
|
||||
}
|
||||
this.arguments[readInt] = new JVM();
|
||||
}
|
||||
|
||||
private void setupMappers() {
|
||||
this.classAliasingMapper = (ClassAliasingMapper) lookupMapperOfType(ClassAliasingMapper.class);
|
||||
this.defaultImplementationsMapper = (DefaultImplementationsMapper) lookupMapperOfType(DefaultImplementationsMapper.class);
|
||||
this.implicitCollectionMapper = (ImplicitCollectionMapper) lookupMapperOfType(ImplicitCollectionMapper.class);
|
||||
this.fieldAliasingMapper = (FieldAliasingMapper) lookupMapperOfType(FieldAliasingMapper.class);
|
||||
this.elementIgnoringMapper = (ElementIgnoringMapper) lookupMapperOfType(ElementIgnoringMapper.class);
|
||||
this.attributeMapper = (AttributeMapper) lookupMapperOfType(AttributeMapper.class);
|
||||
this.localConversionMapper = (LocalConversionMapper) lookupMapperOfType(LocalConversionMapper.class);
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
||||
objectOutputStream.defaultWriteObject();
|
||||
int length = this.arguments.length - 2;
|
||||
objectOutputStream.writeInt(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
objectOutputStream.writeObject(this.arguments[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.AnnotationConfiguration
|
||||
public void autodetectAnnotations(boolean z) {
|
||||
this.locked = !z;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class defaultImplementationOf(Class cls) {
|
||||
if (!this.locked) {
|
||||
processAnnotations(cls);
|
||||
}
|
||||
Class defaultImplementationOf = super.defaultImplementationOf(cls);
|
||||
if (!this.locked) {
|
||||
processAnnotations(defaultImplementationOf);
|
||||
}
|
||||
return defaultImplementationOf;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Converter getLocalConverter(Class cls, String str) {
|
||||
if (!this.locked) {
|
||||
processAnnotations(cls);
|
||||
}
|
||||
return super.getLocalConverter(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.AnnotationConfiguration
|
||||
public void processAnnotations(Class[] clsArr) {
|
||||
if (clsArr == null || clsArr.length == 0) {
|
||||
return;
|
||||
}
|
||||
this.locked = true;
|
||||
UnprocessedTypesSet unprocessedTypesSet = new UnprocessedTypesSet();
|
||||
for (Class cls : clsArr) {
|
||||
unprocessedTypesSet.add((UnprocessedTypesSet) cls);
|
||||
}
|
||||
processTypes(unprocessedTypesSet);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String realMember(Class cls, String str) {
|
||||
if (!this.locked) {
|
||||
processAnnotations(cls);
|
||||
}
|
||||
return super.realMember(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
if (!this.locked) {
|
||||
processAnnotations(cls);
|
||||
}
|
||||
return super.serializedClass(cls);
|
||||
}
|
||||
|
||||
private void processAnnotations(Class cls) {
|
||||
if (cls == null) {
|
||||
return;
|
||||
}
|
||||
UnprocessedTypesSet unprocessedTypesSet = new UnprocessedTypesSet();
|
||||
unprocessedTypesSet.add((UnprocessedTypesSet) cls);
|
||||
processTypes(unprocessedTypesSet);
|
||||
}
|
||||
|
||||
public AnnotationMapper(Mapper mapper, ConverterRegistry converterRegistry, ConverterLookup converterLookup, ClassLoader classLoader, ReflectionProvider reflectionProvider, JVM jvm) {
|
||||
this(mapper, converterRegistry, converterLookup, new ClassLoaderReference(classLoader), reflectionProvider);
|
||||
}
|
||||
}
|
84
sources/com/thoughtworks/xstream/mapper/ArrayMapper.java
Normal file
84
sources/com/thoughtworks/xstream/mapper/ArrayMapper.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.core.util.Primitives;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ArrayMapper extends MapperWrapper {
|
||||
public ArrayMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
private String arrayType(int i, Class cls) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
stringBuffer.append('[');
|
||||
}
|
||||
if (cls.isPrimitive()) {
|
||||
stringBuffer.append(Primitives.representingChar(cls));
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
stringBuffer.append('L');
|
||||
stringBuffer.append(cls.getName());
|
||||
stringBuffer.append(';');
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
private String boxedTypeName(Class cls) {
|
||||
if (Primitives.isBoxed(cls)) {
|
||||
return cls.getName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
int i = 0;
|
||||
while (str.endsWith("-array")) {
|
||||
str = str.substring(0, str.length() - 6);
|
||||
i++;
|
||||
}
|
||||
if (i <= 0) {
|
||||
return super.realClass(str);
|
||||
}
|
||||
Class<?> primitiveType = Primitives.primitiveType(str);
|
||||
if (primitiveType == null) {
|
||||
primitiveType = super.realClass(str);
|
||||
}
|
||||
while (primitiveType.isArray()) {
|
||||
primitiveType = primitiveType.getComponentType();
|
||||
i++;
|
||||
}
|
||||
return super.realClass(arrayType(i, primitiveType));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
String str;
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
while (true) {
|
||||
str = null;
|
||||
if (!cls.isArray()) {
|
||||
break;
|
||||
}
|
||||
str = super.serializedClass(cls);
|
||||
if (!cls.getName().equals(str)) {
|
||||
break;
|
||||
}
|
||||
cls = cls.getComponentType();
|
||||
stringBuffer.append("-array");
|
||||
}
|
||||
if (str == null) {
|
||||
str = boxedTypeName(cls);
|
||||
}
|
||||
if (str == null) {
|
||||
str = super.serializedClass(cls);
|
||||
}
|
||||
if (stringBuffer.length() <= 0) {
|
||||
return str;
|
||||
}
|
||||
StringBuffer stringBuffer2 = new StringBuffer();
|
||||
stringBuffer2.append(str);
|
||||
stringBuffer2.append((Object) stringBuffer);
|
||||
return stringBuffer2.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AttributeAliasingMapper extends AbstractAttributeAliasingMapper {
|
||||
public AttributeAliasingMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String aliasForAttribute(String str) {
|
||||
String str2 = (String) this.nameToAlias.get(str);
|
||||
return str2 == null ? super.aliasForAttribute(str) : str2;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String attributeForAlias(String str) {
|
||||
String str2 = (String) this.aliasToName.get(str);
|
||||
return str2 == null ? super.attributeForAlias(str) : str2;
|
||||
}
|
||||
}
|
117
sources/com/thoughtworks/xstream/mapper/AttributeMapper.java
Normal file
117
sources/com/thoughtworks/xstream/mapper/AttributeMapper.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.converters.Converter;
|
||||
import com.thoughtworks.xstream.converters.ConverterLookup;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AttributeMapper extends MapperWrapper {
|
||||
private ConverterLookup converterLookup;
|
||||
private final Map fieldNameToTypeMap;
|
||||
private final Set fieldToUseAsAttribute;
|
||||
private ReflectionProvider reflectionProvider;
|
||||
private final Set typeSet;
|
||||
|
||||
public AttributeMapper(Mapper mapper) {
|
||||
this(mapper, null, null);
|
||||
}
|
||||
|
||||
private SingleValueConverter getLocalConverterFromItemType(Class cls) {
|
||||
Converter lookupConverterForType = this.converterLookup.lookupConverterForType(cls);
|
||||
if (lookupConverterForType == null || !(lookupConverterForType instanceof SingleValueConverter)) {
|
||||
return null;
|
||||
}
|
||||
return (SingleValueConverter) lookupConverterForType;
|
||||
}
|
||||
|
||||
public void addAttributeFor(String str, Class cls) {
|
||||
this.fieldNameToTypeMap.put(str, cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(String str) {
|
||||
Class cls = (Class) this.fieldNameToTypeMap.get(str);
|
||||
if (cls != null) {
|
||||
return getLocalConverterFromItemType(cls);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(String str, Class cls) {
|
||||
if (this.fieldNameToTypeMap.get(str) == cls) {
|
||||
return getLocalConverterFromItemType(cls);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setConverterLookup(ConverterLookup converterLookup) {
|
||||
this.converterLookup = converterLookup;
|
||||
}
|
||||
|
||||
public boolean shouldLookForSingleValueConverter(String str, Class cls, Class cls2) {
|
||||
Field fieldOrNull;
|
||||
if (this.typeSet.contains(cls) || this.fieldNameToTypeMap.get(str) == cls) {
|
||||
return true;
|
||||
}
|
||||
return (str == null || cls2 == null || (fieldOrNull = this.reflectionProvider.getFieldOrNull(cls2, str)) == null || !this.fieldToUseAsAttribute.contains(fieldOrNull)) ? false : true;
|
||||
}
|
||||
|
||||
public AttributeMapper(Mapper mapper, ConverterLookup converterLookup, ReflectionProvider reflectionProvider) {
|
||||
super(mapper);
|
||||
this.fieldNameToTypeMap = new HashMap();
|
||||
this.typeSet = new HashSet();
|
||||
this.fieldToUseAsAttribute = new HashSet();
|
||||
this.converterLookup = converterLookup;
|
||||
this.reflectionProvider = reflectionProvider;
|
||||
}
|
||||
|
||||
public void addAttributeFor(Class cls) {
|
||||
this.typeSet.add(cls);
|
||||
}
|
||||
|
||||
public void addAttributeFor(Field field) {
|
||||
if (field != null) {
|
||||
this.fieldToUseAsAttribute.add(field);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(Class cls, String str) {
|
||||
Field fieldOrNull = this.reflectionProvider.getFieldOrNull(cls, str);
|
||||
if (fieldOrNull != null) {
|
||||
return getConverterFromAttribute(cls, str, fieldOrNull.getType());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(String str, Class cls, Class cls2) {
|
||||
SingleValueConverter localConverterFromItemType;
|
||||
return (!shouldLookForSingleValueConverter(str, cls, cls2) || (localConverterFromItemType = getLocalConverterFromItemType(cls)) == null) ? super.getConverterFromItemType(str, cls, cls2) : localConverterFromItemType;
|
||||
}
|
||||
|
||||
public void addAttributeFor(Class cls, String str) {
|
||||
addAttributeFor(this.reflectionProvider.getField(cls, str));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(Class cls, String str, Class cls2) {
|
||||
SingleValueConverter localConverterFromItemType;
|
||||
return (!shouldLookForSingleValueConverter(str, cls2, cls) || (localConverterFromItemType = getLocalConverterFromItemType(cls2)) == null) ? super.getConverterFromAttribute(cls, str, cls2) : localConverterFromItemType;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(Class cls) {
|
||||
if (this.typeSet.contains(cls)) {
|
||||
return getLocalConverterFromItemType(cls);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
54
sources/com/thoughtworks/xstream/mapper/CGLIBMapper.java
Normal file
54
sources/com/thoughtworks/xstream/mapper/CGLIBMapper.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import net.sf.cglib.proxy.Enhancer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CGLIBMapper extends MapperWrapper {
|
||||
private static String DEFAULT_NAMING_MARKER = "$$EnhancerByCGLIB$$";
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$CGLIBMapper$Marker;
|
||||
private final String alias;
|
||||
|
||||
public interface Marker {
|
||||
}
|
||||
|
||||
public CGLIBMapper(Mapper mapper) {
|
||||
this(mapper, "CGLIB-enhanced-proxy");
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
if (!str.equals(this.alias)) {
|
||||
return super.realClass(str);
|
||||
}
|
||||
Class cls = class$com$thoughtworks$xstream$mapper$CGLIBMapper$Marker;
|
||||
if (cls != null) {
|
||||
return cls;
|
||||
}
|
||||
Class class$ = class$("com.thoughtworks.xstream.mapper.CGLIBMapper$Marker");
|
||||
class$com$thoughtworks$xstream$mapper$CGLIBMapper$Marker = class$;
|
||||
return class$;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
String serializedClass = super.serializedClass(cls);
|
||||
if (cls == null) {
|
||||
return serializedClass;
|
||||
}
|
||||
String name = cls.getName();
|
||||
return (name.equals(serializedClass) && name.indexOf(DEFAULT_NAMING_MARKER) > 0 && Enhancer.isEnhanced(cls)) ? this.alias : serializedClass;
|
||||
}
|
||||
|
||||
public CGLIBMapper(Mapper mapper, String str) {
|
||||
super(mapper);
|
||||
this.alias = str;
|
||||
}
|
||||
}
|
51
sources/com/thoughtworks/xstream/mapper/CachingMapper.java
Normal file
51
sources/com/thoughtworks/xstream/mapper/CachingMapper.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.XStreamException;
|
||||
import com.thoughtworks.xstream.core.Caching;
|
||||
import com.thoughtworks.xstream.security.ForbiddenClassException;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CachingMapper extends MapperWrapper implements Caching {
|
||||
private transient Map realClassCache;
|
||||
|
||||
public CachingMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
readResolve();
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
this.realClassCache = Collections.synchronizedMap(new HashMap(PeripheralType.SERVO));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.core.Caching
|
||||
public void flushCache() {
|
||||
this.realClassCache.clear();
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
Object obj = this.realClassCache.get(str);
|
||||
if (obj != null) {
|
||||
if (obj instanceof Class) {
|
||||
return (Class) obj;
|
||||
}
|
||||
throw ((XStreamException) obj);
|
||||
}
|
||||
try {
|
||||
Class realClass = super.realClass(str);
|
||||
this.realClassCache.put(str, realClass);
|
||||
return realClass;
|
||||
} catch (CannotResolveClassException e) {
|
||||
this.realClassCache.put(str, e);
|
||||
throw e;
|
||||
} catch (ForbiddenClassException e2) {
|
||||
this.realClassCache.put(str, e2);
|
||||
throw e2;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.XStreamException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CannotResolveClassException extends XStreamException {
|
||||
public CannotResolveClassException(String str) {
|
||||
super(str);
|
||||
}
|
||||
|
||||
public CannotResolveClassException(String str, Throwable th) {
|
||||
super(str, th);
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.core.util.Primitives;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ClassAliasingMapper extends MapperWrapper {
|
||||
private final Map classToName;
|
||||
private transient Map nameToType;
|
||||
private final Map typeToName;
|
||||
|
||||
public ClassAliasingMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.typeToName = new HashMap();
|
||||
this.classToName = new HashMap();
|
||||
this.nameToType = new HashMap();
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
this.nameToType = new HashMap();
|
||||
for (Object obj : this.classToName.keySet()) {
|
||||
this.nameToType.put(this.classToName.get(obj), obj);
|
||||
}
|
||||
for (Class cls : this.typeToName.keySet()) {
|
||||
this.nameToType.put(this.typeToName.get(cls), cls.getName());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void addClassAlias(String str, Class cls) {
|
||||
this.nameToType.put(str, cls.getName());
|
||||
this.classToName.put(cls.getName(), str);
|
||||
}
|
||||
|
||||
public void addClassAttributeAlias(String str, Class cls) {
|
||||
addClassAlias(str, cls);
|
||||
}
|
||||
|
||||
public void addTypeAlias(String str, Class cls) {
|
||||
this.nameToType.put(str, cls.getName());
|
||||
this.typeToName.put(cls, str);
|
||||
}
|
||||
|
||||
public boolean aliasIsAttribute(String str) {
|
||||
return this.nameToType.containsKey(str);
|
||||
}
|
||||
|
||||
public boolean itemTypeAsAttribute(Class cls) {
|
||||
return this.classToName.containsKey(cls.getName());
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
String str2 = (String) this.nameToType.get(str);
|
||||
if (str2 != null) {
|
||||
Class primitiveType = Primitives.primitiveType(str2);
|
||||
if (primitiveType != null) {
|
||||
return primitiveType;
|
||||
}
|
||||
str = str2;
|
||||
}
|
||||
return super.realClass(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
String str = (String) this.classToName.get(cls.getName());
|
||||
if (str != null) {
|
||||
return str;
|
||||
}
|
||||
for (Class cls2 : this.typeToName.keySet()) {
|
||||
if (cls2.isAssignableFrom(cls)) {
|
||||
return (String) this.typeToName.get(cls2);
|
||||
}
|
||||
}
|
||||
return super.serializedClass(cls);
|
||||
}
|
||||
}
|
@@ -0,0 +1,123 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.InitializationException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DefaultImplementationsMapper extends MapperWrapper {
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$Mapper$Null;
|
||||
static /* synthetic */ Class class$java$lang$Boolean;
|
||||
static /* synthetic */ Class class$java$lang$Byte;
|
||||
static /* synthetic */ Class class$java$lang$Character;
|
||||
static /* synthetic */ Class class$java$lang$Double;
|
||||
static /* synthetic */ Class class$java$lang$Float;
|
||||
static /* synthetic */ Class class$java$lang$Integer;
|
||||
static /* synthetic */ Class class$java$lang$Long;
|
||||
static /* synthetic */ Class class$java$lang$Short;
|
||||
private transient Map implToType;
|
||||
private final Map typeToImpl;
|
||||
|
||||
public DefaultImplementationsMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.typeToImpl = new HashMap();
|
||||
this.implToType = new HashMap();
|
||||
addDefaults();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
this.implToType = new HashMap();
|
||||
for (Object obj : this.typeToImpl.keySet()) {
|
||||
this.implToType.put(this.typeToImpl.get(obj), obj);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void addDefaultImplementation(Class cls, Class cls2) {
|
||||
if (cls == null || !cls.isInterface()) {
|
||||
this.typeToImpl.put(cls2, cls);
|
||||
this.implToType.put(cls, cls2);
|
||||
} else {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("Default implementation is not a concrete class: ");
|
||||
stringBuffer.append(cls.getName());
|
||||
throw new InitializationException(stringBuffer.toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected void addDefaults() {
|
||||
Class cls = class$com$thoughtworks$xstream$mapper$Mapper$Null;
|
||||
if (cls == null) {
|
||||
cls = class$("com.thoughtworks.xstream.mapper.Mapper$Null");
|
||||
class$com$thoughtworks$xstream$mapper$Mapper$Null = cls;
|
||||
}
|
||||
addDefaultImplementation(null, cls);
|
||||
Class cls2 = class$java$lang$Boolean;
|
||||
if (cls2 == null) {
|
||||
cls2 = class$("java.lang.Boolean");
|
||||
class$java$lang$Boolean = cls2;
|
||||
}
|
||||
addDefaultImplementation(cls2, Boolean.TYPE);
|
||||
Class cls3 = class$java$lang$Character;
|
||||
if (cls3 == null) {
|
||||
cls3 = class$("java.lang.Character");
|
||||
class$java$lang$Character = cls3;
|
||||
}
|
||||
addDefaultImplementation(cls3, Character.TYPE);
|
||||
Class cls4 = class$java$lang$Integer;
|
||||
if (cls4 == null) {
|
||||
cls4 = class$("java.lang.Integer");
|
||||
class$java$lang$Integer = cls4;
|
||||
}
|
||||
addDefaultImplementation(cls4, Integer.TYPE);
|
||||
Class cls5 = class$java$lang$Float;
|
||||
if (cls5 == null) {
|
||||
cls5 = class$("java.lang.Float");
|
||||
class$java$lang$Float = cls5;
|
||||
}
|
||||
addDefaultImplementation(cls5, Float.TYPE);
|
||||
Class cls6 = class$java$lang$Double;
|
||||
if (cls6 == null) {
|
||||
cls6 = class$("java.lang.Double");
|
||||
class$java$lang$Double = cls6;
|
||||
}
|
||||
addDefaultImplementation(cls6, Double.TYPE);
|
||||
Class cls7 = class$java$lang$Short;
|
||||
if (cls7 == null) {
|
||||
cls7 = class$("java.lang.Short");
|
||||
class$java$lang$Short = cls7;
|
||||
}
|
||||
addDefaultImplementation(cls7, Short.TYPE);
|
||||
Class cls8 = class$java$lang$Byte;
|
||||
if (cls8 == null) {
|
||||
cls8 = class$("java.lang.Byte");
|
||||
class$java$lang$Byte = cls8;
|
||||
}
|
||||
addDefaultImplementation(cls8, Byte.TYPE);
|
||||
Class cls9 = class$java$lang$Long;
|
||||
if (cls9 == null) {
|
||||
cls9 = class$("java.lang.Long");
|
||||
class$java$lang$Long = cls9;
|
||||
}
|
||||
addDefaultImplementation(cls9, Long.TYPE);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class defaultImplementationOf(Class cls) {
|
||||
return this.typeToImpl.containsKey(cls) ? (Class) this.typeToImpl.get(cls) : super.defaultImplementationOf(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
Class cls2 = (Class) this.implToType.get(cls);
|
||||
return cls2 == null ? super.serializedClass(cls) : super.serializedClass(cls2);
|
||||
}
|
||||
}
|
199
sources/com/thoughtworks/xstream/mapper/DefaultMapper.java
Normal file
199
sources/com/thoughtworks/xstream/mapper/DefaultMapper.java
Normal file
@@ -0,0 +1,199 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.converters.Converter;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
import com.thoughtworks.xstream.core.ClassLoaderReference;
|
||||
import com.thoughtworks.xstream.core.util.Primitives;
|
||||
import com.thoughtworks.xstream.mapper.Mapper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DefaultMapper implements Mapper {
|
||||
private static String XSTREAM_PACKAGE_ROOT;
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$DefaultMapper;
|
||||
private final ClassLoaderReference classLoaderReference;
|
||||
|
||||
static {
|
||||
Class cls = class$com$thoughtworks$xstream$mapper$DefaultMapper;
|
||||
if (cls == null) {
|
||||
cls = class$("com.thoughtworks.xstream.mapper.DefaultMapper");
|
||||
class$com$thoughtworks$xstream$mapper$DefaultMapper = cls;
|
||||
}
|
||||
String name = cls.getName();
|
||||
int indexOf = name.indexOf(".xstream.");
|
||||
XSTREAM_PACKAGE_ROOT = indexOf > 0 ? name.substring(0, indexOf + 9) : ".N/A";
|
||||
}
|
||||
|
||||
public DefaultMapper(ClassLoaderReference classLoaderReference) {
|
||||
this.classLoaderReference = classLoaderReference;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String aliasForAttribute(Class cls, String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String aliasForAttribute(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String aliasForSystemAttribute(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String attributeForAlias(Class cls, String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String attributeForAlias(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class defaultImplementationOf(Class cls) {
|
||||
return cls;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(Class cls, String str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(Class cls, String str, Class cls2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(String str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(Class cls) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(String str, Class cls) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(String str, Class cls, Class cls2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String getFieldNameForItemTypeAndName(Class cls, Class cls2, String str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class cls, String str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class getItemTypeForItemFieldName(Class cls, String str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Converter getLocalConverter(Class cls, String str) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isIgnoredElement(String str) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isImmutableValueType(Class cls) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isReferenceable(Class cls) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Mapper lookupMapperOfType(Class cls) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String lookupName(Class cls) {
|
||||
return serializedClass(cls);
|
||||
}
|
||||
|
||||
public Class lookupType(String str) {
|
||||
return realClass(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
ClassLoader reference;
|
||||
Class cls;
|
||||
Class primitiveType = Primitives.primitiveType(str);
|
||||
if (primitiveType != null) {
|
||||
return primitiveType;
|
||||
}
|
||||
try {
|
||||
boolean z = true;
|
||||
if (str.startsWith(XSTREAM_PACKAGE_ROOT)) {
|
||||
if (class$com$thoughtworks$xstream$mapper$DefaultMapper == null) {
|
||||
cls = class$("com.thoughtworks.xstream.mapper.DefaultMapper");
|
||||
class$com$thoughtworks$xstream$mapper$DefaultMapper = cls;
|
||||
} else {
|
||||
cls = class$com$thoughtworks$xstream$mapper$DefaultMapper;
|
||||
}
|
||||
reference = cls.getClassLoader();
|
||||
} else {
|
||||
reference = this.classLoaderReference.getReference();
|
||||
if (str.charAt(0) != '[') {
|
||||
z = false;
|
||||
}
|
||||
}
|
||||
return Class.forName(str, z, reference);
|
||||
} catch (ClassNotFoundException unused) {
|
||||
throw new CannotResolveClassException(str);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String realMember(Class cls, String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
return cls.getName();
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedMember(Class cls, String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean shouldSerializeMember(Class cls, String str) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public DefaultMapper(ClassLoader classLoader) {
|
||||
this(new ClassLoaderReference(classLoader));
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DynamicProxyMapper extends MapperWrapper {
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$DynamicProxyMapper$DynamicProxy;
|
||||
private String alias;
|
||||
|
||||
public static class DynamicProxy {
|
||||
}
|
||||
|
||||
public DynamicProxyMapper(Mapper mapper) {
|
||||
this(mapper, "dynamic-proxy");
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
if (!str.equals(this.alias)) {
|
||||
return super.realClass(str);
|
||||
}
|
||||
Class cls = class$com$thoughtworks$xstream$mapper$DynamicProxyMapper$DynamicProxy;
|
||||
if (cls != null) {
|
||||
return cls;
|
||||
}
|
||||
Class class$ = class$("com.thoughtworks.xstream.mapper.DynamicProxyMapper$DynamicProxy");
|
||||
class$com$thoughtworks$xstream$mapper$DynamicProxyMapper$DynamicProxy = class$;
|
||||
return class$;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
return Proxy.isProxyClass(cls) ? this.alias : super.serializedClass(cls);
|
||||
}
|
||||
|
||||
public void setAlias(String str) {
|
||||
this.alias = str;
|
||||
}
|
||||
|
||||
public DynamicProxyMapper(Mapper mapper, String str) {
|
||||
super(mapper);
|
||||
this.alias = str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.core.util.FastField;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ElementIgnoringMapper extends MapperWrapper {
|
||||
static /* synthetic */ Class class$java$lang$Object;
|
||||
protected final Set fieldsToOmit;
|
||||
protected final Set unknownElementsToIgnore;
|
||||
|
||||
public ElementIgnoringMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.fieldsToOmit = new HashSet();
|
||||
this.unknownElementsToIgnore = new LinkedHashSet();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Object key(Class cls, String str) {
|
||||
return new FastField(cls, str);
|
||||
}
|
||||
|
||||
public void addElementsToIgnore(Pattern pattern) {
|
||||
this.unknownElementsToIgnore.add(pattern);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isIgnoredElement(String str) {
|
||||
if (!this.unknownElementsToIgnore.isEmpty()) {
|
||||
Iterator it = this.unknownElementsToIgnore.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (((Pattern) it.next()).matcher(str).matches()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.isIgnoredElement(str);
|
||||
}
|
||||
|
||||
public void omitField(Class cls, String str) {
|
||||
this.fieldsToOmit.add(key(cls, str));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean shouldSerializeMember(Class cls, String str) {
|
||||
if (this.fieldsToOmit.contains(key(cls, str))) {
|
||||
return false;
|
||||
}
|
||||
Class cls2 = class$java$lang$Object;
|
||||
if (cls2 == null) {
|
||||
cls2 = class$("java.lang.Object");
|
||||
class$java$lang$Object = cls2;
|
||||
}
|
||||
if (cls == cls2 && isIgnoredElement(str)) {
|
||||
return false;
|
||||
}
|
||||
return super.shouldSerializeMember(cls, str);
|
||||
}
|
||||
}
|
90
sources/com/thoughtworks/xstream/mapper/EnumMapper.java
Normal file
90
sources/com/thoughtworks/xstream/mapper/EnumMapper.java
Normal file
@@ -0,0 +1,90 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.converters.ConverterLookup;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
import com.thoughtworks.xstream.converters.enums.EnumSingleValueConverter;
|
||||
import com.thoughtworks.xstream.core.Caching;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class EnumMapper extends MapperWrapper implements Caching {
|
||||
private transient AttributeMapper attributeMapper;
|
||||
private transient Map<Class, SingleValueConverter> enumConverterMap;
|
||||
|
||||
@Deprecated
|
||||
public EnumMapper(Mapper mapper, ConverterLookup converterLookup) {
|
||||
super(mapper);
|
||||
readResolve();
|
||||
}
|
||||
|
||||
private SingleValueConverter getLocalConverter(String str, Class cls, Class cls2) {
|
||||
SingleValueConverter singleValueConverter;
|
||||
if (this.attributeMapper == null || !Enum.class.isAssignableFrom(cls) || !this.attributeMapper.shouldLookForSingleValueConverter(str, cls, cls2)) {
|
||||
return null;
|
||||
}
|
||||
synchronized (this.enumConverterMap) {
|
||||
singleValueConverter = this.enumConverterMap.get(cls);
|
||||
if (singleValueConverter == null) {
|
||||
SingleValueConverter converterFromItemType = super.getConverterFromItemType(str, cls, cls2);
|
||||
if (converterFromItemType == null) {
|
||||
converterFromItemType = new EnumSingleValueConverter(cls);
|
||||
}
|
||||
singleValueConverter = converterFromItemType;
|
||||
this.enumConverterMap.put(cls, singleValueConverter);
|
||||
}
|
||||
}
|
||||
return singleValueConverter;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
this.enumConverterMap = new HashMap();
|
||||
this.attributeMapper = (AttributeMapper) lookupMapperOfType(AttributeMapper.class);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.core.Caching
|
||||
public void flushCache() {
|
||||
if (this.enumConverterMap.size() > 0) {
|
||||
synchronized (this.enumConverterMap) {
|
||||
this.enumConverterMap.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(Class cls, String str, Class cls2) {
|
||||
SingleValueConverter localConverter = getLocalConverter(str, cls2, cls);
|
||||
return localConverter == null ? super.getConverterFromAttribute(cls, str, cls2) : localConverter;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(String str, Class cls, Class cls2) {
|
||||
SingleValueConverter localConverter = getLocalConverter(str, cls, cls2);
|
||||
return localConverter == null ? super.getConverterFromItemType(str, cls, cls2) : localConverter;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isImmutableValueType(Class cls) {
|
||||
return Enum.class.isAssignableFrom(cls) || super.isImmutableValueType(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isReferenceable(Class cls) {
|
||||
if (cls == null || !Enum.class.isAssignableFrom(cls)) {
|
||||
return super.isReferenceable(cls);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
return cls == null ? super.serializedClass(cls) : (!Enum.class.isAssignableFrom(cls) || cls.getSuperclass() == Enum.class) ? EnumSet.class.isAssignableFrom(cls) ? super.serializedClass(EnumSet.class) : super.serializedClass(cls) : super.serializedClass(cls.getSuperclass());
|
||||
}
|
||||
|
||||
public EnumMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
readResolve();
|
||||
}
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.core.util.FastField;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FieldAliasingMapper extends MapperWrapper {
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$ElementIgnoringMapper;
|
||||
static /* synthetic */ Class class$java$lang$Object;
|
||||
protected final Map aliasToFieldMap;
|
||||
private final ElementIgnoringMapper elementIgnoringMapper;
|
||||
protected final Map fieldToAliasMap;
|
||||
|
||||
public FieldAliasingMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.fieldToAliasMap = new HashMap();
|
||||
this.aliasToFieldMap = new HashMap();
|
||||
Class cls = class$com$thoughtworks$xstream$mapper$ElementIgnoringMapper;
|
||||
if (cls == null) {
|
||||
cls = class$("com.thoughtworks.xstream.mapper.ElementIgnoringMapper");
|
||||
class$com$thoughtworks$xstream$mapper$ElementIgnoringMapper = cls;
|
||||
}
|
||||
this.elementIgnoringMapper = (ElementIgnoringMapper) lookupMapperOfType(cls);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String getMember(Class cls, String str, Map map) {
|
||||
String str2 = null;
|
||||
while (str2 == null) {
|
||||
Class cls2 = class$java$lang$Object;
|
||||
if (cls2 == null) {
|
||||
cls2 = class$("java.lang.Object");
|
||||
class$java$lang$Object = cls2;
|
||||
}
|
||||
if (cls == cls2 || cls == null) {
|
||||
break;
|
||||
}
|
||||
str2 = (String) map.get(key(cls, str));
|
||||
cls = cls.getSuperclass();
|
||||
}
|
||||
return str2;
|
||||
}
|
||||
|
||||
private Object key(Class cls, String str) {
|
||||
return new FastField(cls, str);
|
||||
}
|
||||
|
||||
public void addFieldAlias(String str, Class cls, String str2) {
|
||||
this.fieldToAliasMap.put(key(cls, str2), str);
|
||||
this.aliasToFieldMap.put(key(cls, str), str2);
|
||||
}
|
||||
|
||||
public void addFieldsToIgnore(Pattern pattern) {
|
||||
ElementIgnoringMapper elementIgnoringMapper = this.elementIgnoringMapper;
|
||||
if (elementIgnoringMapper != null) {
|
||||
elementIgnoringMapper.addElementsToIgnore(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
public void omitField(Class cls, String str) {
|
||||
ElementIgnoringMapper elementIgnoringMapper = this.elementIgnoringMapper;
|
||||
if (elementIgnoringMapper != null) {
|
||||
elementIgnoringMapper.omitField(cls, str);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String realMember(Class cls, String str) {
|
||||
String member = getMember(cls, str, this.aliasToFieldMap);
|
||||
return member == null ? super.realMember(cls, str) : member;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedMember(Class cls, String str) {
|
||||
String member = getMember(cls, str, this.fieldToAliasMap);
|
||||
return member == null ? super.serializedMember(cls, str) : member;
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ImmutableTypesMapper extends MapperWrapper {
|
||||
private final Set immutableTypes;
|
||||
private final Set unreferenceableTypes;
|
||||
|
||||
public ImmutableTypesMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.unreferenceableTypes = new HashSet();
|
||||
this.immutableTypes = new HashSet();
|
||||
}
|
||||
|
||||
public void addImmutableType(Class cls) {
|
||||
addImmutableType(cls, true);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isImmutableValueType(Class cls) {
|
||||
if (this.immutableTypes.contains(cls)) {
|
||||
return true;
|
||||
}
|
||||
return super.isImmutableValueType(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isReferenceable(Class cls) {
|
||||
if (this.unreferenceableTypes.contains(cls)) {
|
||||
return false;
|
||||
}
|
||||
return super.isReferenceable(cls);
|
||||
}
|
||||
|
||||
public void addImmutableType(Class cls, boolean z) {
|
||||
this.immutableTypes.add(cls);
|
||||
if (z) {
|
||||
this.unreferenceableTypes.remove(cls);
|
||||
} else {
|
||||
this.unreferenceableTypes.add(cls);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,348 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.InitializationException;
|
||||
import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
|
||||
import com.thoughtworks.xstream.core.util.Primitives;
|
||||
import com.thoughtworks.xstream.mapper.Mapper;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ImplicitCollectionMapper extends MapperWrapper {
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$Mapper$Null;
|
||||
static /* synthetic */ Class class$java$lang$Object;
|
||||
static /* synthetic */ Class class$java$util$Collection;
|
||||
static /* synthetic */ Class class$java$util$Map;
|
||||
static /* synthetic */ Class class$java$util$Map$Entry;
|
||||
private final Map classNameToMapper;
|
||||
private ReflectionProvider reflectionProvider;
|
||||
|
||||
private class ImplicitCollectionMapperForClass {
|
||||
private Class definedIn;
|
||||
private Map namedItemTypeToDef = new HashMap();
|
||||
private Map itemFieldNameToDef = new HashMap();
|
||||
private Map fieldNameToDef = new HashMap();
|
||||
|
||||
ImplicitCollectionMapperForClass(Class cls) {
|
||||
this.definedIn = cls;
|
||||
}
|
||||
|
||||
private ImplicitCollectionMappingImpl getImplicitCollectionDefByItemFieldName(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
ImplicitCollectionMappingImpl implicitCollectionMappingImpl = (ImplicitCollectionMappingImpl) this.itemFieldNameToDef.get(str);
|
||||
if (implicitCollectionMappingImpl != null) {
|
||||
return implicitCollectionMappingImpl;
|
||||
}
|
||||
ImplicitCollectionMapperForClass mapper = ImplicitCollectionMapper.this.getMapper(this.definedIn.getSuperclass(), null);
|
||||
if (mapper != null) {
|
||||
return mapper.getImplicitCollectionDefByItemFieldName(str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void add(ImplicitCollectionMappingImpl implicitCollectionMappingImpl) {
|
||||
this.fieldNameToDef.put(implicitCollectionMappingImpl.getFieldName(), implicitCollectionMappingImpl);
|
||||
this.namedItemTypeToDef.put(implicitCollectionMappingImpl.createNamedItemType(), implicitCollectionMappingImpl);
|
||||
if (implicitCollectionMappingImpl.getItemFieldName() != null) {
|
||||
this.itemFieldNameToDef.put(implicitCollectionMappingImpl.getItemFieldName(), implicitCollectionMappingImpl);
|
||||
}
|
||||
}
|
||||
|
||||
public String getFieldNameForItemTypeAndName(Class cls, String str) {
|
||||
Iterator it = this.namedItemTypeToDef.keySet().iterator();
|
||||
ImplicitCollectionMappingImpl implicitCollectionMappingImpl = null;
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
NamedItemType namedItemType = (NamedItemType) it.next();
|
||||
ImplicitCollectionMappingImpl implicitCollectionMappingImpl2 = (ImplicitCollectionMappingImpl) this.namedItemTypeToDef.get(namedItemType);
|
||||
Class cls2 = ImplicitCollectionMapper.class$com$thoughtworks$xstream$mapper$Mapper$Null;
|
||||
if (cls2 == null) {
|
||||
cls2 = ImplicitCollectionMapper.class$("com.thoughtworks.xstream.mapper.Mapper$Null");
|
||||
ImplicitCollectionMapper.class$com$thoughtworks$xstream$mapper$Mapper$Null = cls2;
|
||||
}
|
||||
if (cls == cls2) {
|
||||
implicitCollectionMappingImpl = implicitCollectionMappingImpl2;
|
||||
break;
|
||||
}
|
||||
if (namedItemType.itemType.isAssignableFrom(cls)) {
|
||||
if (implicitCollectionMappingImpl2.getItemFieldName() != null) {
|
||||
if (implicitCollectionMappingImpl2.getItemFieldName().equals(str)) {
|
||||
return implicitCollectionMappingImpl2.getFieldName();
|
||||
}
|
||||
} else if (implicitCollectionMappingImpl == null || implicitCollectionMappingImpl.getItemType() == null || (implicitCollectionMappingImpl2.getItemType() != null && implicitCollectionMappingImpl.getItemType().isAssignableFrom(implicitCollectionMappingImpl2.getItemType()))) {
|
||||
implicitCollectionMappingImpl = implicitCollectionMappingImpl2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (implicitCollectionMappingImpl != null) {
|
||||
return implicitCollectionMappingImpl.getFieldName();
|
||||
}
|
||||
ImplicitCollectionMapperForClass mapper = ImplicitCollectionMapper.this.getMapper(this.definedIn.getSuperclass(), null);
|
||||
if (mapper != null) {
|
||||
return mapper.getFieldNameForItemTypeAndName(cls, str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(String str) {
|
||||
Mapper.ImplicitCollectionMapping implicitCollectionMapping = (Mapper.ImplicitCollectionMapping) this.fieldNameToDef.get(str);
|
||||
if (implicitCollectionMapping != null) {
|
||||
return implicitCollectionMapping;
|
||||
}
|
||||
ImplicitCollectionMapperForClass mapper = ImplicitCollectionMapper.this.getMapper(this.definedIn.getSuperclass(), null);
|
||||
if (mapper != null) {
|
||||
return mapper.getImplicitCollectionDefForFieldName(str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Class getItemTypeForItemFieldName(String str) {
|
||||
ImplicitCollectionMappingImpl implicitCollectionDefByItemFieldName = getImplicitCollectionDefByItemFieldName(str);
|
||||
if (implicitCollectionDefByItemFieldName != null) {
|
||||
return implicitCollectionDefByItemFieldName.getItemType();
|
||||
}
|
||||
ImplicitCollectionMapperForClass mapper = ImplicitCollectionMapper.this.getMapper(this.definedIn.getSuperclass(), null);
|
||||
if (mapper != null) {
|
||||
return mapper.getItemTypeForItemFieldName(str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ImplicitCollectionMappingImpl implements Mapper.ImplicitCollectionMapping {
|
||||
private final String fieldName;
|
||||
private final String itemFieldName;
|
||||
private final Class itemType;
|
||||
private final String keyFieldName;
|
||||
|
||||
ImplicitCollectionMappingImpl(String str, Class cls, String str2, String str3) {
|
||||
this.fieldName = str;
|
||||
this.itemFieldName = str2;
|
||||
this.itemType = cls;
|
||||
this.keyFieldName = str3;
|
||||
}
|
||||
|
||||
public NamedItemType createNamedItemType() {
|
||||
return new NamedItemType(this.itemType, this.itemFieldName);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMapping
|
||||
public String getFieldName() {
|
||||
return this.fieldName;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMapping
|
||||
public String getItemFieldName() {
|
||||
return this.itemFieldName;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMapping
|
||||
public Class getItemType() {
|
||||
return this.itemType;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper.ImplicitCollectionMapping
|
||||
public String getKeyFieldName() {
|
||||
return this.keyFieldName;
|
||||
}
|
||||
}
|
||||
|
||||
private static class NamedItemType {
|
||||
String itemFieldName;
|
||||
Class itemType;
|
||||
|
||||
NamedItemType(Class cls, String str) {
|
||||
if (cls == null && (cls = ImplicitCollectionMapper.class$java$lang$Object) == null) {
|
||||
cls = ImplicitCollectionMapper.class$("java.lang.Object");
|
||||
ImplicitCollectionMapper.class$java$lang$Object = cls;
|
||||
}
|
||||
this.itemType = cls;
|
||||
this.itemFieldName = str;
|
||||
}
|
||||
|
||||
private static boolean isEquals(Object obj, Object obj2) {
|
||||
return obj == null ? obj2 == null : obj.equals(obj2);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof NamedItemType)) {
|
||||
return false;
|
||||
}
|
||||
NamedItemType namedItemType = (NamedItemType) obj;
|
||||
return this.itemType.equals(namedItemType.itemType) && isEquals(this.itemFieldName, namedItemType.itemFieldName);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int hashCode = this.itemType.hashCode() << 7;
|
||||
String str = this.itemFieldName;
|
||||
return str != null ? hashCode + str.hashCode() : hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
public ImplicitCollectionMapper(Mapper mapper, ReflectionProvider reflectionProvider) {
|
||||
super(mapper);
|
||||
this.classNameToMapper = new HashMap();
|
||||
this.reflectionProvider = reflectionProvider;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public ImplicitCollectionMapperForClass getMapper(Class cls, String str) {
|
||||
Field fieldOrNull = str != null ? this.reflectionProvider.getFieldOrNull(cls, str) : null;
|
||||
Class<?> declaringClass = fieldOrNull != null ? fieldOrNull.getDeclaringClass() : null;
|
||||
while (cls != null) {
|
||||
ImplicitCollectionMapperForClass implicitCollectionMapperForClass = (ImplicitCollectionMapperForClass) this.classNameToMapper.get(cls);
|
||||
if (implicitCollectionMapperForClass != null) {
|
||||
return implicitCollectionMapperForClass;
|
||||
}
|
||||
if (cls == declaringClass) {
|
||||
break;
|
||||
}
|
||||
cls = cls.getSuperclass();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ImplicitCollectionMapperForClass getOrCreateMapper(Class cls) {
|
||||
ImplicitCollectionMapperForClass implicitCollectionMapperForClass = (ImplicitCollectionMapperForClass) this.classNameToMapper.get(cls);
|
||||
if (implicitCollectionMapperForClass != null) {
|
||||
return implicitCollectionMapperForClass;
|
||||
}
|
||||
ImplicitCollectionMapperForClass implicitCollectionMapperForClass2 = new ImplicitCollectionMapperForClass(cls);
|
||||
this.classNameToMapper.put(cls, implicitCollectionMapperForClass2);
|
||||
return implicitCollectionMapperForClass2;
|
||||
}
|
||||
|
||||
public void add(Class cls, String str, Class cls2) {
|
||||
add(cls, str, null, cls2);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String getFieldNameForItemTypeAndName(Class cls, Class cls2, String str) {
|
||||
ImplicitCollectionMapperForClass mapper = getMapper(cls, null);
|
||||
if (mapper != null) {
|
||||
return mapper.getFieldNameForItemTypeAndName(cls2, str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class cls, String str) {
|
||||
ImplicitCollectionMapperForClass mapper = getMapper(cls, str);
|
||||
if (mapper != null) {
|
||||
return mapper.getImplicitCollectionDefForFieldName(str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class getItemTypeForItemFieldName(Class cls, String str) {
|
||||
ImplicitCollectionMapperForClass mapper = getMapper(cls, null);
|
||||
if (mapper != null) {
|
||||
return mapper.getItemTypeForItemFieldName(str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void add(Class cls, String str, String str2, Class cls2) {
|
||||
add(cls, str, str2, cls2, null);
|
||||
}
|
||||
|
||||
public void add(Class cls, String str, String str2, Class cls2, String str3) {
|
||||
Field field;
|
||||
if (cls != null) {
|
||||
Class cls3 = cls;
|
||||
loop0: do {
|
||||
field = null;
|
||||
while (true) {
|
||||
Class cls4 = class$java$lang$Object;
|
||||
if (cls4 == null) {
|
||||
cls4 = class$("java.lang.Object");
|
||||
class$java$lang$Object = cls4;
|
||||
}
|
||||
if (cls3 == cls4) {
|
||||
break loop0;
|
||||
}
|
||||
try {
|
||||
field = cls3.getDeclaredField(str);
|
||||
break;
|
||||
} catch (NoSuchFieldException unused) {
|
||||
cls3 = cls3.getSuperclass();
|
||||
} catch (SecurityException e) {
|
||||
throw new InitializationException("Access denied for field with implicit collection", e);
|
||||
}
|
||||
}
|
||||
} while (Modifier.isStatic(field.getModifiers()));
|
||||
} else {
|
||||
field = null;
|
||||
}
|
||||
if (field != null) {
|
||||
Class cls5 = class$java$util$Map;
|
||||
if (cls5 == null) {
|
||||
cls5 = class$("java.util.Map");
|
||||
class$java$util$Map = cls5;
|
||||
}
|
||||
if (!cls5.isAssignableFrom(field.getType())) {
|
||||
Class cls6 = class$java$util$Collection;
|
||||
if (cls6 == null) {
|
||||
cls6 = class$("java.util.Collection");
|
||||
class$java$util$Collection = cls6;
|
||||
}
|
||||
if (!cls6.isAssignableFrom(field.getType())) {
|
||||
Class<?> type = field.getType();
|
||||
if (type.isArray()) {
|
||||
Class componentType = type.getComponentType();
|
||||
if (componentType.isPrimitive()) {
|
||||
componentType = Primitives.box(componentType);
|
||||
}
|
||||
if (cls2 == null) {
|
||||
cls2 = componentType;
|
||||
} else {
|
||||
if (cls2.isPrimitive()) {
|
||||
cls2 = Primitives.box(cls2);
|
||||
}
|
||||
if (!componentType.isAssignableFrom(cls2)) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("Field \"");
|
||||
stringBuffer.append(str);
|
||||
stringBuffer.append("\" declares an array, but the array type is not compatible with ");
|
||||
stringBuffer.append(cls2.getName());
|
||||
throw new InitializationException(stringBuffer.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
StringBuffer stringBuffer2 = new StringBuffer();
|
||||
stringBuffer2.append("Field \"");
|
||||
stringBuffer2.append(str);
|
||||
stringBuffer2.append("\" declares no collection or array");
|
||||
throw new InitializationException(stringBuffer2.toString());
|
||||
}
|
||||
}
|
||||
} else if (str2 == null && str3 == null && (cls2 = class$java$util$Map$Entry) == null) {
|
||||
cls2 = class$("java.util.Map$Entry");
|
||||
class$java$util$Map$Entry = cls2;
|
||||
}
|
||||
getOrCreateMapper(cls).add(new ImplicitCollectionMappingImpl(str, cls2, str2, str3));
|
||||
return;
|
||||
}
|
||||
StringBuffer stringBuffer3 = new StringBuffer();
|
||||
stringBuffer3.append("No field \"");
|
||||
stringBuffer3.append(str);
|
||||
stringBuffer3.append("\" for implicit collection");
|
||||
throw new InitializationException(stringBuffer3.toString());
|
||||
}
|
||||
}
|
50
sources/com/thoughtworks/xstream/mapper/LambdaMapper.java
Normal file
50
sources/com/thoughtworks/xstream/mapper/LambdaMapper.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.core.util.Types;
|
||||
import com.thoughtworks.xstream.mapper.Mapper;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LambdaMapper extends MapperWrapper {
|
||||
public LambdaMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
Class<?> cls2 = null;
|
||||
if (Types.isLambdaType(cls)) {
|
||||
if (Serializable.class.isAssignableFrom(cls)) {
|
||||
Class<?>[] interfaces = cls.getInterfaces();
|
||||
if (interfaces.length > 1) {
|
||||
for (int i = 0; cls2 == null && i < interfaces.length; i++) {
|
||||
Class<?> cls3 = interfaces[i];
|
||||
Method[] methods = cls3.getMethods();
|
||||
int length = methods.length;
|
||||
int i2 = 0;
|
||||
while (true) {
|
||||
if (i2 < length) {
|
||||
Method method = methods[i2];
|
||||
if (!method.isDefault() && !Modifier.isStatic(method.getModifiers())) {
|
||||
cls2 = cls3;
|
||||
break;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cls2 = interfaces[0];
|
||||
}
|
||||
} else {
|
||||
cls2 = Mapper.Null.class;
|
||||
}
|
||||
}
|
||||
if (cls2 != null) {
|
||||
cls = cls2;
|
||||
}
|
||||
return super.serializedClass(cls);
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.converters.Converter;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
import com.thoughtworks.xstream.core.util.FastField;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LocalConversionMapper extends MapperWrapper {
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$AttributeMapper;
|
||||
private transient AttributeMapper attributeMapper;
|
||||
private final Map localConverters;
|
||||
|
||||
public LocalConversionMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.localConverters = new HashMap();
|
||||
readResolve();
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
private SingleValueConverter getLocalSingleValueConverter(Class cls, String str, Class cls2) {
|
||||
Converter localConverter;
|
||||
AttributeMapper attributeMapper = this.attributeMapper;
|
||||
if (attributeMapper == null || !attributeMapper.shouldLookForSingleValueConverter(str, cls2, cls) || (localConverter = getLocalConverter(cls, str)) == null || !(localConverter instanceof SingleValueConverter)) {
|
||||
return null;
|
||||
}
|
||||
return (SingleValueConverter) localConverter;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
Class cls = class$com$thoughtworks$xstream$mapper$AttributeMapper;
|
||||
if (cls == null) {
|
||||
cls = class$("com.thoughtworks.xstream.mapper.AttributeMapper");
|
||||
class$com$thoughtworks$xstream$mapper$AttributeMapper = cls;
|
||||
}
|
||||
this.attributeMapper = (AttributeMapper) lookupMapperOfType(cls);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(Class cls, String str, Class cls2) {
|
||||
SingleValueConverter localSingleValueConverter = getLocalSingleValueConverter(cls, str, cls2);
|
||||
return localSingleValueConverter == null ? super.getConverterFromAttribute(cls, str, cls2) : localSingleValueConverter;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(String str, Class cls, Class cls2) {
|
||||
SingleValueConverter localSingleValueConverter = getLocalSingleValueConverter(cls2, str, cls);
|
||||
return localSingleValueConverter == null ? super.getConverterFromItemType(str, cls, cls2) : localSingleValueConverter;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Converter getLocalConverter(Class cls, String str) {
|
||||
return (Converter) this.localConverters.get(new FastField(cls, str));
|
||||
}
|
||||
|
||||
public void registerLocalConverter(Class cls, String str, Converter converter) {
|
||||
this.localConverters.put(new FastField(cls, str), converter);
|
||||
}
|
||||
}
|
71
sources/com/thoughtworks/xstream/mapper/Mapper.java
Normal file
71
sources/com/thoughtworks/xstream/mapper/Mapper.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.converters.Converter;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Mapper {
|
||||
|
||||
public interface ImplicitCollectionMapping {
|
||||
String getFieldName();
|
||||
|
||||
String getItemFieldName();
|
||||
|
||||
Class getItemType();
|
||||
|
||||
String getKeyFieldName();
|
||||
}
|
||||
|
||||
public static class Null {
|
||||
}
|
||||
|
||||
String aliasForAttribute(Class cls, String str);
|
||||
|
||||
String aliasForAttribute(String str);
|
||||
|
||||
String aliasForSystemAttribute(String str);
|
||||
|
||||
String attributeForAlias(Class cls, String str);
|
||||
|
||||
String attributeForAlias(String str);
|
||||
|
||||
Class defaultImplementationOf(Class cls);
|
||||
|
||||
SingleValueConverter getConverterFromAttribute(Class cls, String str);
|
||||
|
||||
SingleValueConverter getConverterFromAttribute(Class cls, String str, Class cls2);
|
||||
|
||||
SingleValueConverter getConverterFromAttribute(String str);
|
||||
|
||||
SingleValueConverter getConverterFromItemType(Class cls);
|
||||
|
||||
SingleValueConverter getConverterFromItemType(String str, Class cls);
|
||||
|
||||
SingleValueConverter getConverterFromItemType(String str, Class cls, Class cls2);
|
||||
|
||||
String getFieldNameForItemTypeAndName(Class cls, Class cls2, String str);
|
||||
|
||||
ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class cls, String str);
|
||||
|
||||
Class getItemTypeForItemFieldName(Class cls, String str);
|
||||
|
||||
Converter getLocalConverter(Class cls, String str);
|
||||
|
||||
boolean isIgnoredElement(String str);
|
||||
|
||||
boolean isImmutableValueType(Class cls);
|
||||
|
||||
boolean isReferenceable(Class cls);
|
||||
|
||||
Mapper lookupMapperOfType(Class cls);
|
||||
|
||||
Class realClass(String str);
|
||||
|
||||
String realMember(Class cls, String str);
|
||||
|
||||
String serializedClass(Class cls);
|
||||
|
||||
String serializedMember(Class cls, String str);
|
||||
|
||||
boolean shouldSerializeMember(Class cls, String str);
|
||||
}
|
250
sources/com/thoughtworks/xstream/mapper/MapperWrapper.java
Normal file
250
sources/com/thoughtworks/xstream/mapper/MapperWrapper.java
Normal file
@@ -0,0 +1,250 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.converters.Converter;
|
||||
import com.thoughtworks.xstream.converters.SingleValueConverter;
|
||||
import com.thoughtworks.xstream.mapper.Mapper;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class MapperWrapper implements Mapper {
|
||||
static /* synthetic */ Class class$com$thoughtworks$xstream$mapper$MapperWrapper;
|
||||
private final Mapper aliasForAttributeMapper;
|
||||
private final Mapper aliasForSystemAttributeMapper;
|
||||
private final Mapper attributeForAliasMapper;
|
||||
private final Mapper defaultImplementationOfMapper;
|
||||
private final Mapper getConverterFromAttributeMapper;
|
||||
private final Mapper getConverterFromItemTypeMapper;
|
||||
private final Mapper getFieldNameForItemTypeAndNameMapper;
|
||||
private final Mapper getImplicitCollectionDefForFieldNameMapper;
|
||||
private final Mapper getItemTypeForItemFieldNameMapper;
|
||||
private final Mapper getLocalConverterMapper;
|
||||
private final Mapper isIgnoredElementMapper;
|
||||
private final Mapper isImmutableValueTypeMapper;
|
||||
private final Mapper isReferenceableMapper;
|
||||
private final Mapper realClassMapper;
|
||||
private final Mapper realMemberMapper;
|
||||
private final Mapper serializedClassMapper;
|
||||
private final Mapper serializedMemberMapper;
|
||||
private final Mapper shouldSerializeMemberMapper;
|
||||
private final Mapper wrapped;
|
||||
|
||||
public MapperWrapper(Mapper mapper) {
|
||||
this.wrapped = mapper;
|
||||
if (!(mapper instanceof MapperWrapper)) {
|
||||
this.aliasForAttributeMapper = mapper;
|
||||
this.aliasForSystemAttributeMapper = mapper;
|
||||
this.attributeForAliasMapper = mapper;
|
||||
this.defaultImplementationOfMapper = mapper;
|
||||
this.getConverterFromAttributeMapper = mapper;
|
||||
this.getConverterFromItemTypeMapper = mapper;
|
||||
this.getFieldNameForItemTypeAndNameMapper = mapper;
|
||||
this.getImplicitCollectionDefForFieldNameMapper = mapper;
|
||||
this.getItemTypeForItemFieldNameMapper = mapper;
|
||||
this.getLocalConverterMapper = mapper;
|
||||
this.isIgnoredElementMapper = mapper;
|
||||
this.isImmutableValueTypeMapper = mapper;
|
||||
this.isReferenceableMapper = mapper;
|
||||
this.realClassMapper = mapper;
|
||||
this.realMemberMapper = mapper;
|
||||
this.serializedClassMapper = mapper;
|
||||
this.serializedMemberMapper = mapper;
|
||||
this.shouldSerializeMemberMapper = mapper;
|
||||
return;
|
||||
}
|
||||
MapperWrapper mapperWrapper = (MapperWrapper) mapper;
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("aliasForAttribute", mapperWrapper.aliasForAttributeMapper);
|
||||
hashMap.put("aliasForSystemAttribute", mapperWrapper.aliasForSystemAttributeMapper);
|
||||
hashMap.put("attributeForAlias", mapperWrapper.attributeForAliasMapper);
|
||||
hashMap.put("defaultImplementationOf", mapperWrapper.defaultImplementationOfMapper);
|
||||
hashMap.put("getConverterFromAttribute", mapperWrapper.getConverterFromAttributeMapper);
|
||||
hashMap.put("getConverterFromItemType", mapperWrapper.getConverterFromItemTypeMapper);
|
||||
hashMap.put("getFieldNameForItemTypeAndName", mapperWrapper.getFieldNameForItemTypeAndNameMapper);
|
||||
hashMap.put("getImplicitCollectionDefForFieldName", mapperWrapper.getImplicitCollectionDefForFieldNameMapper);
|
||||
hashMap.put("getItemTypeForItemFieldName", mapperWrapper.getItemTypeForItemFieldNameMapper);
|
||||
String str = "getLocalConverter";
|
||||
hashMap.put("getLocalConverter", mapperWrapper.getLocalConverterMapper);
|
||||
hashMap.put("isIgnoredElement", mapperWrapper.isIgnoredElementMapper);
|
||||
hashMap.put("isImmutableValueType", mapperWrapper.isImmutableValueTypeMapper);
|
||||
hashMap.put("isReferenceable", mapperWrapper.isReferenceableMapper);
|
||||
hashMap.put("realClass", mapperWrapper.realClassMapper);
|
||||
hashMap.put("realMember", mapperWrapper.realMemberMapper);
|
||||
hashMap.put("serializedClass", mapperWrapper.serializedClassMapper);
|
||||
hashMap.put("serializedMember", mapperWrapper.serializedMemberMapper);
|
||||
hashMap.put("shouldSerializeMember", mapperWrapper.shouldSerializeMemberMapper);
|
||||
Method[] methods = mapper.getClass().getMethods();
|
||||
int i = 0;
|
||||
while (i < methods.length) {
|
||||
Method method = methods[i];
|
||||
Method[] methodArr = methods;
|
||||
Class<?> declaringClass = method.getDeclaringClass();
|
||||
Class<?> cls = class$com$thoughtworks$xstream$mapper$MapperWrapper;
|
||||
if (cls == null) {
|
||||
cls = class$("com.thoughtworks.xstream.mapper.MapperWrapper");
|
||||
class$com$thoughtworks$xstream$mapper$MapperWrapper = cls;
|
||||
}
|
||||
String str2 = str;
|
||||
if (declaringClass != cls) {
|
||||
String name = method.getName();
|
||||
if (hashMap.containsKey(name)) {
|
||||
hashMap.put(name, mapper);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
methods = methodArr;
|
||||
str = str2;
|
||||
}
|
||||
this.aliasForAttributeMapper = (Mapper) hashMap.get("aliasForAttribute");
|
||||
this.aliasForSystemAttributeMapper = (Mapper) hashMap.get("aliasForSystemAttribute");
|
||||
this.attributeForAliasMapper = (Mapper) hashMap.get("attributeForAlias");
|
||||
this.defaultImplementationOfMapper = (Mapper) hashMap.get("defaultImplementationOf");
|
||||
this.getConverterFromAttributeMapper = (Mapper) hashMap.get("getConverterFromAttribute");
|
||||
this.getConverterFromItemTypeMapper = (Mapper) hashMap.get("getConverterFromItemType");
|
||||
this.getFieldNameForItemTypeAndNameMapper = (Mapper) hashMap.get("getFieldNameForItemTypeAndName");
|
||||
this.getImplicitCollectionDefForFieldNameMapper = (Mapper) hashMap.get("getImplicitCollectionDefForFieldName");
|
||||
this.getItemTypeForItemFieldNameMapper = (Mapper) hashMap.get("getItemTypeForItemFieldName");
|
||||
this.getLocalConverterMapper = (Mapper) hashMap.get(str);
|
||||
this.isIgnoredElementMapper = (Mapper) hashMap.get("isIgnoredElement");
|
||||
this.isImmutableValueTypeMapper = (Mapper) hashMap.get("isImmutableValueType");
|
||||
this.isReferenceableMapper = (Mapper) hashMap.get("isReferenceable");
|
||||
this.realClassMapper = (Mapper) hashMap.get("realClass");
|
||||
this.realMemberMapper = (Mapper) hashMap.get("realMember");
|
||||
this.serializedClassMapper = (Mapper) hashMap.get("serializedClass");
|
||||
this.serializedMemberMapper = (Mapper) hashMap.get("serializedMember");
|
||||
this.shouldSerializeMemberMapper = (Mapper) hashMap.get("shouldSerializeMember");
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String aliasForAttribute(String str) {
|
||||
return this.aliasForAttributeMapper.aliasForAttribute(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String aliasForSystemAttribute(String str) {
|
||||
return this.aliasForSystemAttributeMapper.aliasForSystemAttribute(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String attributeForAlias(String str) {
|
||||
return this.attributeForAliasMapper.attributeForAlias(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class defaultImplementationOf(Class cls) {
|
||||
return this.defaultImplementationOfMapper.defaultImplementationOf(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(String str) {
|
||||
return this.getConverterFromAttributeMapper.getConverterFromAttribute(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(String str, Class cls) {
|
||||
return this.getConverterFromItemTypeMapper.getConverterFromItemType(str, cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String getFieldNameForItemTypeAndName(Class cls, Class cls2, String str) {
|
||||
return this.getFieldNameForItemTypeAndNameMapper.getFieldNameForItemTypeAndName(cls, cls2, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Mapper.ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class cls, String str) {
|
||||
return this.getImplicitCollectionDefForFieldNameMapper.getImplicitCollectionDefForFieldName(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class getItemTypeForItemFieldName(Class cls, String str) {
|
||||
return this.getItemTypeForItemFieldNameMapper.getItemTypeForItemFieldName(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Converter getLocalConverter(Class cls, String str) {
|
||||
return this.getLocalConverterMapper.getLocalConverter(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isIgnoredElement(String str) {
|
||||
return this.isIgnoredElementMapper.isIgnoredElement(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isImmutableValueType(Class cls) {
|
||||
return this.isImmutableValueTypeMapper.isImmutableValueType(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean isReferenceable(Class cls) {
|
||||
return this.isReferenceableMapper.isReferenceable(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Mapper lookupMapperOfType(Class cls) {
|
||||
return cls.isAssignableFrom(getClass()) ? this : this.wrapped.lookupMapperOfType(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
return this.realClassMapper.realClass(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String realMember(Class cls, String str) {
|
||||
return this.realMemberMapper.realMember(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
return this.serializedClassMapper.serializedClass(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedMember(Class cls, String str) {
|
||||
return this.serializedMemberMapper.serializedMember(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public boolean shouldSerializeMember(Class cls, String str) {
|
||||
return this.shouldSerializeMemberMapper.shouldSerializeMember(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String aliasForAttribute(Class cls, String str) {
|
||||
return this.aliasForAttributeMapper.aliasForAttribute(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public String attributeForAlias(Class cls, String str) {
|
||||
return this.attributeForAliasMapper.attributeForAlias(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(Class cls, String str) {
|
||||
return this.getConverterFromAttributeMapper.getConverterFromAttribute(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(Class cls) {
|
||||
return this.getConverterFromItemTypeMapper.getConverterFromItemType(cls);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromAttribute(Class cls, String str, Class cls2) {
|
||||
return this.getConverterFromAttributeMapper.getConverterFromAttribute(cls, str, cls2);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.Mapper
|
||||
public SingleValueConverter getConverterFromItemType(String str, Class cls, Class cls2) {
|
||||
return this.getConverterFromItemTypeMapper.getConverterFromItemType(str, cls, cls2);
|
||||
}
|
||||
}
|
114
sources/com/thoughtworks/xstream/mapper/OuterClassMapper.java
Normal file
114
sources/com/thoughtworks/xstream/mapper/OuterClassMapper.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.core.Caching;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OuterClassMapper extends MapperWrapper implements Caching {
|
||||
private static final String[] EMPTY_NAMES = new String[0];
|
||||
static /* synthetic */ Class class$java$lang$Object;
|
||||
private final String alias;
|
||||
private final Map innerFields;
|
||||
|
||||
public OuterClassMapper(Mapper mapper) {
|
||||
this(mapper, "outer-class");
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class$(String str) {
|
||||
try {
|
||||
return Class.forName(str);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new NoClassDefFoundError().initCause(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] getInnerFieldNames(Class cls) {
|
||||
String[] strArr = (String[]) this.innerFields.get(cls.getName());
|
||||
if (strArr != null) {
|
||||
return strArr;
|
||||
}
|
||||
String[] innerFieldNames = getInnerFieldNames(cls.getSuperclass());
|
||||
String[] strArr2 = innerFieldNames;
|
||||
for (Field field : cls.getDeclaredFields()) {
|
||||
if (field.getName().startsWith("this$")) {
|
||||
String[] strArr3 = new String[strArr2.length + 1];
|
||||
System.arraycopy(strArr2, 0, strArr3, 0, strArr2.length);
|
||||
strArr3[strArr3.length - 1] = field.getName();
|
||||
strArr2 = strArr3;
|
||||
}
|
||||
}
|
||||
this.innerFields.put(cls.getName(), strArr2);
|
||||
return strArr2;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.core.Caching
|
||||
public void flushCache() {
|
||||
Set keySet = this.innerFields.keySet();
|
||||
Class cls = class$java$lang$Object;
|
||||
if (cls == null) {
|
||||
cls = class$("java.lang.Object");
|
||||
class$java$lang$Object = cls;
|
||||
}
|
||||
keySet.retainAll(Collections.singletonList(cls.getName()));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String realMember(Class cls, String str) {
|
||||
if (str.startsWith(this.alias)) {
|
||||
int i = -1;
|
||||
int length = this.alias.length();
|
||||
if (length == str.length()) {
|
||||
i = 0;
|
||||
} else {
|
||||
int i2 = length + 1;
|
||||
if (str.length() > i2 && str.charAt(length) == '-') {
|
||||
i = Integer.valueOf(str.substring(i2)).intValue();
|
||||
}
|
||||
}
|
||||
if (i >= 0) {
|
||||
String[] innerFieldNames = getInnerFieldNames(cls);
|
||||
if (i < innerFieldNames.length) {
|
||||
return innerFieldNames[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.realMember(cls, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedMember(Class cls, String str) {
|
||||
if (str.startsWith("this$")) {
|
||||
String[] innerFieldNames = getInnerFieldNames(cls);
|
||||
for (int i = 0; i < innerFieldNames.length; i++) {
|
||||
if (innerFieldNames[i].equals(str)) {
|
||||
if (i == 0) {
|
||||
return this.alias;
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(this.alias);
|
||||
stringBuffer.append('-');
|
||||
stringBuffer.append(i);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.serializedMember(cls, str);
|
||||
}
|
||||
|
||||
public OuterClassMapper(Mapper mapper, String str) {
|
||||
super(mapper);
|
||||
this.alias = str;
|
||||
this.innerFields = Collections.synchronizedMap(new HashMap());
|
||||
Map map = this.innerFields;
|
||||
Class cls = class$java$lang$Object;
|
||||
if (cls == null) {
|
||||
cls = class$("java.lang.Object");
|
||||
class$java$lang$Object = cls;
|
||||
}
|
||||
map.put(cls.getName(), EMPTY_NAMES);
|
||||
}
|
||||
}
|
@@ -0,0 +1,116 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PackageAliasingMapper extends MapperWrapper implements Serializable {
|
||||
private static final Comparator REVERSE = new Comparator() { // from class: com.thoughtworks.xstream.mapper.PackageAliasingMapper.1
|
||||
@Override // java.util.Comparator
|
||||
public int compare(Object obj, Object obj2) {
|
||||
return ((String) obj2).compareTo((String) obj);
|
||||
}
|
||||
};
|
||||
protected transient Map nameToPackage;
|
||||
private Map packageToName;
|
||||
|
||||
public PackageAliasingMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
this.packageToName = new TreeMap(REVERSE);
|
||||
this.nameToPackage = new HashMap();
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
||||
this.packageToName = new TreeMap(REVERSE);
|
||||
this.packageToName.putAll((Map) objectInputStream.readObject());
|
||||
this.nameToPackage = new HashMap();
|
||||
for (Object obj : this.packageToName.keySet()) {
|
||||
this.nameToPackage.put(this.packageToName.get(obj), obj);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
||||
objectOutputStream.writeObject(new HashMap(this.packageToName));
|
||||
}
|
||||
|
||||
public void addPackageAlias(String str, String str2) {
|
||||
if (str.length() > 0 && str.charAt(str.length() - 1) != '.') {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(str);
|
||||
stringBuffer.append('.');
|
||||
str = stringBuffer.toString();
|
||||
}
|
||||
if (str2.length() > 0 && str2.charAt(str2.length() - 1) != '.') {
|
||||
StringBuffer stringBuffer2 = new StringBuffer();
|
||||
stringBuffer2.append(str2);
|
||||
stringBuffer2.append('.');
|
||||
str2 = stringBuffer2.toString();
|
||||
}
|
||||
this.nameToPackage.put(str, str2);
|
||||
this.packageToName.put(str2, str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
String stringBuffer;
|
||||
int length = str.length();
|
||||
while (true) {
|
||||
int lastIndexOf = str.lastIndexOf(46, length);
|
||||
if (lastIndexOf < 0) {
|
||||
stringBuffer = "";
|
||||
} else {
|
||||
StringBuffer stringBuffer2 = new StringBuffer();
|
||||
stringBuffer2.append(str.substring(0, lastIndexOf));
|
||||
stringBuffer2.append('.');
|
||||
stringBuffer = stringBuffer2.toString();
|
||||
}
|
||||
String str2 = (String) this.nameToPackage.get(stringBuffer);
|
||||
if (str2 != null) {
|
||||
StringBuffer stringBuffer3 = new StringBuffer();
|
||||
stringBuffer3.append(str2);
|
||||
if (lastIndexOf >= 0) {
|
||||
str = str.substring(lastIndexOf + 1);
|
||||
}
|
||||
stringBuffer3.append(str);
|
||||
str = stringBuffer3.toString();
|
||||
} else {
|
||||
int i = lastIndexOf - 1;
|
||||
if (lastIndexOf < 0) {
|
||||
break;
|
||||
}
|
||||
length = i;
|
||||
}
|
||||
}
|
||||
return super.realClass(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
String name = cls.getName();
|
||||
int length = name.length();
|
||||
while (true) {
|
||||
int lastIndexOf = name.lastIndexOf(46, length);
|
||||
String str = (String) this.packageToName.get(lastIndexOf < 0 ? "" : name.substring(0, lastIndexOf + 1));
|
||||
if (str != null) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(str);
|
||||
if (lastIndexOf >= 0) {
|
||||
name = name.substring(lastIndexOf + 1);
|
||||
}
|
||||
stringBuffer.append(name);
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
int i = lastIndexOf - 1;
|
||||
if (lastIndexOf < 0) {
|
||||
return super.serializedClass(cls);
|
||||
}
|
||||
length = i;
|
||||
}
|
||||
}
|
||||
}
|
41
sources/com/thoughtworks/xstream/mapper/SecurityMapper.java
Normal file
41
sources/com/thoughtworks/xstream/mapper/SecurityMapper.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
import com.thoughtworks.xstream.security.AnyTypePermission;
|
||||
import com.thoughtworks.xstream.security.ForbiddenClassException;
|
||||
import com.thoughtworks.xstream.security.NoTypePermission;
|
||||
import com.thoughtworks.xstream.security.TypePermission;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SecurityMapper extends MapperWrapper {
|
||||
private final List permissions;
|
||||
|
||||
public SecurityMapper(Mapper mapper) {
|
||||
this(mapper, null);
|
||||
}
|
||||
|
||||
public void addPermission(TypePermission typePermission) {
|
||||
if (typePermission.equals(NoTypePermission.NONE) || typePermission.equals(AnyTypePermission.ANY)) {
|
||||
this.permissions.clear();
|
||||
}
|
||||
this.permissions.add(0, typePermission);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
Class realClass = super.realClass(str);
|
||||
for (int i = 0; i < this.permissions.size(); i++) {
|
||||
if (((TypePermission) this.permissions.get(i)).allows(realClass)) {
|
||||
return realClass;
|
||||
}
|
||||
}
|
||||
throw new ForbiddenClassException(realClass);
|
||||
}
|
||||
|
||||
public SecurityMapper(Mapper mapper, TypePermission[] typePermissionArr) {
|
||||
super(mapper);
|
||||
this.permissions = typePermissionArr == null ? new ArrayList() : new ArrayList(Arrays.asList(typePermissionArr));
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SystemAttributeAliasingMapper extends AbstractAttributeAliasingMapper {
|
||||
public SystemAttributeAliasingMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String aliasForSystemAttribute(String str) {
|
||||
String str2 = (String) this.nameToAlias.get(str);
|
||||
if (str2 != null || this.nameToAlias.containsKey(str)) {
|
||||
return str2;
|
||||
}
|
||||
String aliasForSystemAttribute = super.aliasForSystemAttribute(str);
|
||||
return aliasForSystemAttribute == str ? super.aliasForAttribute(str) : aliasForSystemAttribute;
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class XStream11XmlFriendlyMapper extends AbstractXmlFriendlyMapper {
|
||||
public XStream11XmlFriendlyMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
public String mapNameFromXML(String str) {
|
||||
return unescapeFieldName(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
return super.realClass(unescapeClassName(str));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String realMember(Class cls, String str) {
|
||||
return unescapeFieldName(super.realMember(cls, str));
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.thoughtworks.xstream.mapper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class XmlFriendlyMapper extends AbstractXmlFriendlyMapper {
|
||||
public XmlFriendlyMapper(Mapper mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
public String mapNameFromXML(String str) {
|
||||
return unescapeFieldName(str);
|
||||
}
|
||||
|
||||
public String mapNameToXML(String str) {
|
||||
return escapeFieldName(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public Class realClass(String str) {
|
||||
return super.realClass(unescapeClassName(str));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String realMember(Class cls, String str) {
|
||||
return unescapeFieldName(super.realMember(cls, str));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedClass(Class cls) {
|
||||
return escapeClassName(super.serializedClass(cls));
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.mapper.MapperWrapper, com.thoughtworks.xstream.mapper.Mapper
|
||||
public String serializedMember(Class cls, String str) {
|
||||
return escapeFieldName(super.serializedMember(cls, str));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user