Rabbit-R1/switch port/java/sources/com/alibaba/fastjson/serializer/SerializeConfig.java

103 lines
4.3 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package com.alibaba.fastjson.serializer;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.util.IdentityHashMap;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Currency;
import java.util.Locale;
import java.util.TimeZone;
import java.util.UUID;
import java.util.regex.Pattern;
/* loaded from: classes2.dex */
public class SerializeConfig {
public static final SerializeConfig globalInstance = new SerializeConfig();
public PropertyNamingStrategy propertyNamingStrategy;
private final IdentityHashMap<ObjectSerializer> serializers;
protected String typeKey = JSON.DEFAULT_TYPE_KEY;
public static final SerializeConfig getGlobalInstance() {
return globalInstance;
}
public String getTypeKey() {
return this.typeKey;
}
public void setTypeKey(String str) {
this.typeKey = str;
}
public ObjectSerializer registerIfNotExists(Class<?> cls) {
return registerIfNotExists(cls, cls.getModifiers(), false, true, true, true);
}
public ObjectSerializer registerIfNotExists(Class<?> cls, int i, boolean z, boolean z2, boolean z3, boolean z4) {
ObjectSerializer objectSerializer = this.serializers.get(cls);
if (objectSerializer != null) {
return objectSerializer;
}
JavaBeanSerializer javaBeanSerializer = new JavaBeanSerializer(cls, i, null, z, z2, z3, z4, this.propertyNamingStrategy);
this.serializers.put(cls, javaBeanSerializer);
return javaBeanSerializer;
}
public SerializeConfig() {
IdentityHashMap<ObjectSerializer> identityHashMap = new IdentityHashMap<>(1024);
this.serializers = identityHashMap;
identityHashMap.put(Boolean.class, BooleanCodec.instance);
identityHashMap.put(Character.class, MiscCodec.instance);
identityHashMap.put(Byte.class, IntegerCodec.instance);
identityHashMap.put(Short.class, IntegerCodec.instance);
identityHashMap.put(Integer.class, IntegerCodec.instance);
identityHashMap.put(Long.class, IntegerCodec.instance);
identityHashMap.put(Float.class, NumberCodec.instance);
identityHashMap.put(Double.class, NumberCodec.instance);
identityHashMap.put(Number.class, NumberCodec.instance);
identityHashMap.put(BigDecimal.class, BigDecimalCodec.instance);
identityHashMap.put(BigInteger.class, BigDecimalCodec.instance);
identityHashMap.put(String.class, StringCodec.instance);
identityHashMap.put(Object[].class, ArrayCodec.instance);
identityHashMap.put(Class.class, MiscCodec.instance);
identityHashMap.put(SimpleDateFormat.class, MiscCodec.instance);
identityHashMap.put(Locale.class, MiscCodec.instance);
identityHashMap.put(Currency.class, MiscCodec.instance);
identityHashMap.put(TimeZone.class, MiscCodec.instance);
identityHashMap.put(UUID.class, MiscCodec.instance);
identityHashMap.put(URI.class, MiscCodec.instance);
identityHashMap.put(URL.class, MiscCodec.instance);
identityHashMap.put(Pattern.class, MiscCodec.instance);
identityHashMap.put(Charset.class, MiscCodec.instance);
}
/* JADX WARN: Code restructure failed: missing block: B:79:0x015d, code lost:
r6 = false;
r2 = true;
*/
/* JADX WARN: Removed duplicated region for block: B:11:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:8:0x019f */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public com.alibaba.fastjson.serializer.ObjectSerializer get(java.lang.Class<?> r10) {
/*
Method dump skipped, instructions count: 425
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.alibaba.fastjson.serializer.SerializeConfig.get(java.lang.Class):com.alibaba.fastjson.serializer.ObjectSerializer");
}
public boolean put(Type type, ObjectSerializer objectSerializer) {
return this.serializers.put(type, objectSerializer);
}
}