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>
arrayWriter
Json-Smart ArrayWriterClassstatic JsonWriterI<Object>
beansWriter
Json-Smart V1 Beans serialiserstatic JsonWriterI<Object>
beansWriterASM
Json-Smart V2 Beans serialiser Based on ASMstatic JsonWriterI<Enum<?>>
EnumWriter
static JsonWriterI<Iterable<? extends Object>>
JSONIterableWriter
static JsonWriterI<JSONAwareEx>
JSONJSONAwareExWriter
static JsonWriterI<JSONAware>
JSONJSONAwareWriter
static JsonWriterI<Map<String,? extends Object>>
JSONMapWriter
static JsonWriterI<JSONStreamAwareEx>
JSONStreamAwareExWriter
static JsonWriterI<JSONStreamAwareEx>
JSONStreamAwareWriter
static JsonWriterI<Object>
toStringWriter
ToString Writer
-
Constructor Summary
Constructors Constructor Description JsonWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addInterfaceWriterFirst(Class<?> interFace, JsonWriterI<?> writer)
Deprecated.use registerWriterInterfaceFirstvoid
addInterfaceWriterLast(Class<?> interFace, JsonWriterI<?> writer)
Deprecated.use registerWriterInterfaceLastJsonWriterI
getWrite(Class cls)
JsonWriterI
getWriterByInterface(Class<?> clazz)
try to find a Writer by Checking implemented interfacevoid
init()
<T> void
registerWriter(JsonWriterI<T> writer, Class<?>... cls)
associate an Writer to a Classvoid
registerWriterInterface(Class<?> interFace, JsonWriterI<?> writer)
an alias for registerWriterInterfaceLastvoid
registerWriterInterfaceFirst(Class<?> interFace, JsonWriterI<?> writer)
associate an Writer to a interface With Hi priorityvoid
registerWriterInterfaceLast(Class<?> interFace, JsonWriterI<?> writer)
associate an Writer to a interface With Low priority<T> void
remapField(Class<T> type, String fromJava, String toJson)
remap field name in custom classesstatic void
writeJSONKV(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
-
-