Initial commit
This commit is contained in:
12
sources/com/thoughtworks/xstream/io/naming/NameCoder.java
Normal file
12
sources/com/thoughtworks/xstream/io/naming/NameCoder.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.thoughtworks.xstream.io.naming;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface NameCoder {
|
||||
String decodeAttribute(String str);
|
||||
|
||||
String decodeNode(String str);
|
||||
|
||||
String encodeAttribute(String str);
|
||||
|
||||
String encodeNode(String str);
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.thoughtworks.xstream.io.naming;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class NameCoderWrapper implements NameCoder {
|
||||
private final NameCoder wrapped;
|
||||
|
||||
public NameCoderWrapper(NameCoder nameCoder) {
|
||||
this.wrapped = nameCoder;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String decodeAttribute(String str) {
|
||||
return this.wrapped.decodeAttribute(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String decodeNode(String str) {
|
||||
return this.wrapped.decodeNode(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String encodeAttribute(String str) {
|
||||
return this.wrapped.encodeAttribute(str);
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String encodeNode(String str) {
|
||||
return this.wrapped.encodeNode(str);
|
||||
}
|
||||
}
|
24
sources/com/thoughtworks/xstream/io/naming/NoNameCoder.java
Normal file
24
sources/com/thoughtworks/xstream/io/naming/NoNameCoder.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.thoughtworks.xstream.io.naming;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class NoNameCoder implements NameCoder {
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String decodeAttribute(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String decodeNode(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String encodeAttribute(String str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String encodeNode(String str) {
|
||||
return str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
package com.thoughtworks.xstream.io.naming;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StaticNameCoder implements NameCoder {
|
||||
private transient Map attribute2Java;
|
||||
private final Map java2Attribute;
|
||||
private final Map java2Node;
|
||||
private transient Map node2Java;
|
||||
|
||||
public StaticNameCoder(Map map, Map map2) {
|
||||
this.java2Node = new HashMap(map);
|
||||
if (map == map2 || map2 == null) {
|
||||
this.java2Attribute = this.java2Node;
|
||||
} else {
|
||||
this.java2Attribute = new HashMap(map2);
|
||||
}
|
||||
readResolve();
|
||||
}
|
||||
|
||||
private Map invertMap(Map map) {
|
||||
HashMap hashMap = new HashMap(map.size());
|
||||
for (Map.Entry entry : map.entrySet()) {
|
||||
hashMap.put((String) entry.getValue(), (String) entry.getKey());
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
this.node2Java = invertMap(this.java2Node);
|
||||
Map map = this.java2Node;
|
||||
Map map2 = this.java2Attribute;
|
||||
if (map == map2) {
|
||||
this.attribute2Java = this.node2Java;
|
||||
} else {
|
||||
this.attribute2Java = invertMap(map2);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String decodeAttribute(String str) {
|
||||
String str2 = (String) this.attribute2Java.get(str);
|
||||
return str2 == null ? str : str2;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String decodeNode(String str) {
|
||||
String str2 = (String) this.node2Java.get(str);
|
||||
return str2 == null ? str : str2;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String encodeAttribute(String str) {
|
||||
String str2 = (String) this.java2Attribute.get(str);
|
||||
return str2 == null ? str : str2;
|
||||
}
|
||||
|
||||
@Override // com.thoughtworks.xstream.io.naming.NameCoder
|
||||
public String encodeNode(String str) {
|
||||
String str2 = (String) this.java2Node.get(str);
|
||||
return str2 == null ? str : str2;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user