mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 16:42:30 -06:00
24 lines
1 KiB
Java
24 lines
1 KiB
Java
package com.alibaba.fastjson.serializer;
|
|
|
|
import java.io.IOException;
|
|
import java.lang.reflect.Type;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public class EnumSerializer implements ObjectSerializer {
|
|
@Override // com.alibaba.fastjson.serializer.ObjectSerializer
|
|
public void write(JSONSerializer jSONSerializer, Object obj, Object obj2, Type type) throws IOException {
|
|
SerializeWriter serializeWriter = jSONSerializer.out;
|
|
if ((serializeWriter.features & SerializerFeature.WriteEnumUsingToString.mask) != 0) {
|
|
String str = ((Enum) obj).toString();
|
|
if ((serializeWriter.features & SerializerFeature.UseSingleQuotes.mask) != 0) {
|
|
serializeWriter.writeStringWithSingleQuote(str);
|
|
return;
|
|
} else {
|
|
serializeWriter.writeStringWithDoubleQuote(str, (char) 0, false);
|
|
return;
|
|
}
|
|
}
|
|
serializeWriter.writeInt(((Enum) obj).ordinal());
|
|
}
|
|
}
|