public class JsonWriter extends Object implements BinderJsonWriter
BinderWriter implementation using org.json library,
JsonWriter serializes POJO into JSON string, the serialization is guided by mapping schema defined in the POJO using Nano annotations.
| Modifier and Type | Field and Description |
|---|---|
protected BinderOptions |
options |
| Constructor and Description |
|---|
JsonWriter() |
JsonWriter(BinderOptions options) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
isList(Object obj) |
String |
write(Object source)
Write POJO into string.
|
void |
write(Object source,
OutputStream os)
Write POJO into output stream of bytes.
|
void |
write(Object source,
Writer out)
Write POJO into character stream.
|
String |
writeCollection(Collection<?> source) |
void |
writeCollection(Collection<?> source,
OutputStream os) |
void |
writeCollection(Collection<?> source,
Writer out) |
String |
writeMap(Map<?,?> source) |
void |
writeMap(Map<?,?> source,
OutputStream os) |
void |
writeMap(Map<?,?> source,
Writer out) |
protected BinderOptions options
public JsonWriter()
public JsonWriter(BinderOptions options)
public String write(Object source) throws WriterException, MappingException
BinderWriterwrite in interface BinderWritersource - an POJOWriterException - if writes failMappingExceptionpublic void write(Object source, Writer out) throws WriterException, MappingException
BinderWriterwrite in interface BinderWritersource - an POJOout - a character streamWriterException - if writes failMappingExceptionpublic void write(Object source, OutputStream os) throws WriterException, MappingException
BinderWriterwrite in interface BinderWritersource - an POJOos - an output stream of bytes.WriterException - if writes failMappingExceptionpublic void writeCollection(Collection<?> source, Writer out) throws WriterException, MappingException
writeCollection in interface BinderJsonWriterWriterExceptionMappingExceptionpublic void writeCollection(Collection<?> source, OutputStream os) throws WriterException, MappingException
writeCollection in interface BinderJsonWriterWriterExceptionMappingExceptionpublic String writeCollection(Collection<?> source) throws WriterException, MappingException
writeCollection in interface BinderJsonWriterWriterExceptionMappingExceptionprotected boolean isList(Object obj)
public void writeMap(Map<?,?> source, Writer out) throws WriterException, MappingException
writeMap in interface BinderJsonWriterWriterExceptionMappingExceptionpublic void writeMap(Map<?,?> source, OutputStream os) throws WriterException, MappingException
writeMap in interface BinderJsonWriterWriterExceptionMappingExceptionpublic String writeMap(Map<?,?> source) throws WriterException, MappingException
writeMap in interface BinderJsonWriterWriterExceptionMappingExceptionCopyright © 2016. All rights reserved.