Package net.minidev.json.reader
Class JsonWriter
- java.lang.Object
-
- net.minidev.json.reader.JsonWriter
-
public class JsonWriter extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static JsonWriterI<Object>arrayWriterJson-Smart ArrayWriterClassstatic JsonWriterI<Object>beansWriterJson-Smart V1 Beans serialiserstatic JsonWriterI<Object>beansWriterASMJson-Smart V2 Beans serialiser Based on ASMstatic JsonWriterI<Enum<?>>EnumWriterstatic JsonWriterI<Iterable<? extends Object>>JSONIterableWriterstatic JsonWriterI<JSONAwareEx>JSONJSONAwareExWriterstatic JsonWriterI<JSONAware>JSONJSONAwareWriterstatic JsonWriterI<Map<String,? extends Object>>JSONMapWriterstatic JsonWriterI<JSONStreamAwareEx>JSONStreamAwareExWriterstatic JsonWriterI<JSONStreamAwareEx>JSONStreamAwareWriterstatic JsonWriterI<Object>toStringWriterToString Writer
-
Constructor Summary
Constructors Constructor Description JsonWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddInterfaceWriterFirst(Class<?> interFace, JsonWriterI<?> writer)Deprecated.use registerWriterInterfaceFirstvoidaddInterfaceWriterLast(Class<?> interFace, JsonWriterI<?> writer)Deprecated.use registerWriterInterfaceLastJsonWriterIgetWrite(Class cls)JsonWriterIgetWriterByInterface(Class<?> clazz)try to find a Writer by Checking implemented interfacevoidinit()<T> voidregisterWriter(JsonWriterI<T> writer, Class<?>... cls)associate an Writer to a ClassvoidregisterWriterInterface(Class<?> interFace, JsonWriterI<?> writer)an alias for registerWriterInterfaceLastvoidregisterWriterInterfaceFirst(Class<?> interFace, JsonWriterI<?> writer)associate an Writer to a interface With Hi priorityvoidregisterWriterInterfaceLast(Class<?> interFace, JsonWriterI<?> writer)associate an Writer to a interface With Low priority<T> voidremapField(Class<T> type, String fromJava, String toJson)remap field name in custom classesstatic voidwriteJSONKV(String key, Object value, Appendable out, JSONStyle compression)Write a Key : value entry to a stream
-
-
-
Field Detail
-
JSONStreamAwareWriter
public static final JsonWriterI<JSONStreamAwareEx> JSONStreamAwareWriter
-
JSONStreamAwareExWriter
public static final JsonWriterI<JSONStreamAwareEx> JSONStreamAwareExWriter
-
JSONJSONAwareExWriter
public static final JsonWriterI<JSONAwareEx> JSONJSONAwareExWriter
-
JSONJSONAwareWriter
public static final JsonWriterI<JSONAware> JSONJSONAwareWriter
-
JSONIterableWriter
public static final JsonWriterI<Iterable<? extends Object>> JSONIterableWriter
-
EnumWriter
public static final JsonWriterI<Enum<?>> EnumWriter
-
JSONMapWriter
public static final JsonWriterI<Map<String,? extends Object>> JSONMapWriter
-
beansWriterASM
public static final JsonWriterI<Object> beansWriterASM
Json-Smart V2 Beans serialiser Based on ASM
-
beansWriter
public static final JsonWriterI<Object> beansWriter
Json-Smart V1 Beans serialiser
-
arrayWriter
public static final JsonWriterI<Object> arrayWriter
Json-Smart ArrayWriterClass
-
toStringWriter
public static final JsonWriterI<Object> toStringWriter
ToString Writer
-
-
Method Detail
-
remapField
public <T> void remapField(Class<T> type, String fromJava, String toJson)
remap field name in custom classes- Parameters:
fromJava- field name in javatoJson- field name in json- Since:
- 2.1.1
-
getWriterByInterface
public JsonWriterI getWriterByInterface(Class<?> clazz)
try to find a Writer by Checking implemented interface- Parameters:
clazz- class to serialize- Returns:
- a Writer or null
-
getWrite
public JsonWriterI getWrite(Class cls)
-
init
public void init()
-
addInterfaceWriterFirst
public void addInterfaceWriterFirst(Class<?> interFace, JsonWriterI<?> writer)
Deprecated.use registerWriterInterfaceFirstassociate an Writer to a interface With Hi priority- Parameters:
interFace- interface to mapwriter- writer Object
-
addInterfaceWriterLast
public void addInterfaceWriterLast(Class<?> interFace, JsonWriterI<?> writer)
Deprecated.use registerWriterInterfaceLastassociate an Writer to a interface With Low priority- Parameters:
interFace- interface to mapwriter- writer Object
-
registerWriterInterfaceLast
public void registerWriterInterfaceLast(Class<?> interFace, JsonWriterI<?> writer)
associate an Writer to a interface With Low priority- Parameters:
interFace- interface to mapwriter- writer Object
-
registerWriterInterfaceFirst
public void registerWriterInterfaceFirst(Class<?> interFace, JsonWriterI<?> writer)
associate an Writer to a interface With Hi priority- Parameters:
interFace- interface to mapwriter- writer Object
-
registerWriterInterface
public void registerWriterInterface(Class<?> interFace, JsonWriterI<?> writer)
an alias for registerWriterInterfaceLast- Parameters:
interFace- interface to mapwriter- writer Object
-
registerWriter
public <T> void registerWriter(JsonWriterI<T> writer, Class<?>... cls)
associate an Writer to a Class- Parameters:
writer-cls-
-
writeJSONKV
public static void writeJSONKV(String key, Object value, Appendable out, JSONStyle compression) throws IOException
Write a Key : value entry to a stream- Throws:
IOException
-
-