Java Code Examples for com.alibaba.fastjson.JSON.DEFAULT_TYPE_KEY

The following are Jave code examples for showing how to use DEFAULT_TYPE_KEY of the com.alibaba.fastjson.JSON class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: boohee_v5.6   File: SerializeConfig.java   Source Code and License Vote up 4 votes
public SerializeConfig(int tableSize) {
    super(tableSize);
    this.asm = !ASMUtils.isAndroid();
    this.typeKey = JSON.DEFAULT_TYPE_KEY;
    try {
        this.asmFactory = new ASMSerializerFactory();
    } catch (ExceptionInInitializerError e) {
        this.asm = false;
    }
    put(Boolean.class, BooleanCodec.instance);
    put(Character.class, CharacterCodec.instance);
    put(Byte.class, IntegerCodec.instance);
    put(Short.class, IntegerCodec.instance);
    put(Integer.class, IntegerCodec.instance);
    put(Long.class, LongCodec.instance);
    put(Float.class, FloatCodec.instance);
    put(Double.class, DoubleSerializer.instance);
    put(BigDecimal.class, BigDecimalCodec.instance);
    put(BigInteger.class, BigIntegerCodec.instance);
    put(String.class, StringCodec.instance);
    put(byte[].class, ByteArraySerializer.instance);
    put(short[].class, ShortArraySerializer.instance);
    put(int[].class, IntArraySerializer.instance);
    put(long[].class, LongArraySerializer.instance);
    put(float[].class, FloatArraySerializer.instance);
    put(double[].class, DoubleArraySerializer.instance);
    put(boolean[].class, BooleanArraySerializer.instance);
    put(char[].class, CharArraySerializer.instance);
    put(Object[].class, ObjectArraySerializer.instance);
    put(Class.class, ClassSerializer.instance);
    put(SimpleDateFormat.class, DateFormatSerializer.instance);
    put(Locale.class, LocaleCodec.instance);
    put(Currency.class, CurrencyCodec.instance);
    put(TimeZone.class, TimeZoneCodec.instance);
    put(UUID.class, UUIDCodec.instance);
    put(InetAddress.class, InetAddressCodec.instance);
    put(Inet4Address.class, InetAddressCodec.instance);
    put(Inet6Address.class, InetAddressCodec.instance);
    put(InetSocketAddress.class, InetSocketAddressCodec.instance);
    put(File.class, FileCodec.instance);
    put(URI.class, URICodec.instance);
    put(URL.class, URLCodec.instance);
    put(Appendable.class, AppendableSerializer.instance);
    put(StringBuffer.class, AppendableSerializer.instance);
    put(StringBuilder.class, AppendableSerializer.instance);
    put(Pattern.class, PatternCodec.instance);
    put(Charset.class, CharsetCodec.instance);
    put(AtomicBoolean.class, AtomicBooleanSerializer.instance);
    put(AtomicInteger.class, AtomicIntegerSerializer.instance);
    put(AtomicLong.class, AtomicLongSerializer.instance);
    put(AtomicReference.class, ReferenceCodec.instance);
    put(AtomicIntegerArray.class, AtomicIntegerArrayCodec.instance);
    put(AtomicLongArray.class, AtomicLongArrayCodec.instance);
    put(WeakReference.class, ReferenceCodec.instance);
    put(SoftReference.class, ReferenceCodec.instance);
    try {
        put(Class.forName("java.awt.Color"), ColorCodec.instance);
        put(Class.forName("java.awt.Font"), FontCodec.instance);
        put(Class.forName("java.awt.Point"), PointCodec.instance);
        put(Class.forName("java.awt.Rectangle"), RectangleCodec.instance);
    } catch (Throwable th) {
    }
    try {
        put(Class.forName("java.time.LocalDateTime"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.LocalDate"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.LocalTime"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.ZonedDateTime"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.OffsetDateTime"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.OffsetTime"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.ZoneOffset"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.ZoneRegion"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.Period"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.Duration"), Jdk8DateCodec.instance);
        put(Class.forName("java.time.Instant"), Jdk8DateCodec.instance);
    } catch (Throwable th2) {
    }
}