Package com.floragunn.codova.documents
Class DocWriter
- java.lang.Object
-
- com.floragunn.codova.documents.DocWriter
-
public class DocWriter extends Object
A lightweight, reflection-less way of serializing JSON. Is capable of handling these basic Java types: - Collection - Map - String - Character - Boolean - Number - Enum - Date - Instant - LocalDateTime/OffsetDateTime Additionally, it handles these codova types: - Document (and thus DocNode) - UnparsedDoc
-
-
Constructor Summary
Constructors Constructor Description DocWriter(com.fasterxml.jackson.core.JsonFactory jsonFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DocWriterformat(Format format)static DocWriterjson()DocWritermapValues(Function<Object,Object> valueMapper)DocWriterpretty()DocWriterpretty(boolean pretty)static DocWritersmile()voidwrite(File file, Document<?> document)voidwrite(File file, Object object)byte[]writeAsBytes(Document<?> document)byte[]writeAsBytes(Object object)StringwriteAsString(Document<?> document)StringwriteAsString(Object object)static DocWriteryaml()
-
-
-
Method Detail
-
json
public static DocWriter json()
-
yaml
public static DocWriter yaml()
-
smile
public static DocWriter smile()
-
pretty
public DocWriter pretty()
-
pretty
public DocWriter pretty(boolean pretty)
-
writeAsBytes
public byte[] writeAsBytes(Object object)
-
write
public void write(File file, Object object) throws IOException
- Throws:
IOException
-
writeAsBytes
public byte[] writeAsBytes(Document<?> document)
-
write
public void write(File file, Document<?> document) throws IOException
- Throws:
IOException
-
-