public final class JSONSerializer
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
serializeFromField(java.lang.Object containingObject,
java.lang.String fieldName,
int indentWidth,
boolean onlySerializePublicFields)
Recursively serialize the named field of an object, skipping transient and final fields.
|
static java.lang.String |
serializeFromField(java.lang.Object containingObject,
java.lang.String fieldName,
int indentWidth,
boolean onlySerializePublicFields,
nonapi.io.github.classgraph.json.ClassFieldCache classFieldCache)
Recursively serialize the named field of an object, skipping transient and final fields.
|
static java.lang.String |
serializeObject(java.lang.Object obj)
Recursively serialize an Object (or array, list, map or set of objects) to JSON, skipping transient and final
fields.
|
static java.lang.String |
serializeObject(java.lang.Object obj,
int indentWidth,
boolean onlySerializePublicFields)
Recursively serialize an Object (or array, list, map or set of objects) to JSON, skipping transient and final
fields.
|
static java.lang.String |
serializeObject(java.lang.Object obj,
int indentWidth,
boolean onlySerializePublicFields,
nonapi.io.github.classgraph.json.ClassFieldCache classFieldCache)
Recursively serialize an Object (or array, list, map or set of objects) to JSON, skipping transient and final
fields.
|
public static java.lang.String serializeObject(java.lang.Object obj,
int indentWidth,
boolean onlySerializePublicFields,
nonapi.io.github.classgraph.json.ClassFieldCache classFieldCache)
obj - The root object of the object graph to serialize.indentWidth - If indentWidth == 0, no prettyprinting indentation is performed, otherwise this specifies the
number of spaces to indent each level of JSON.onlySerializePublicFields - If true, only serialize public fields.classFieldCache - The class field cache. Reusing this cache will increase the speed if many JSON documents of the
same type need to be produced.java.lang.IllegalArgumentException - If anything goes wrong during serialization.public static java.lang.String serializeObject(java.lang.Object obj,
int indentWidth,
boolean onlySerializePublicFields)
obj - The root object of the object graph to serialize.indentWidth - If indentWidth == 0, no prettyprinting indentation is performed, otherwise this specifies the
number of spaces to indent each level of JSON.onlySerializePublicFields - If true, only serialize public fields.java.lang.IllegalArgumentException - If anything goes wrong during serialization.public static java.lang.String serializeObject(java.lang.Object obj)
obj - The root object of the object graph to serialize.java.lang.IllegalArgumentException - If anything goes wrong during serialization.public static java.lang.String serializeFromField(java.lang.Object containingObject,
java.lang.String fieldName,
int indentWidth,
boolean onlySerializePublicFields,
nonapi.io.github.classgraph.json.ClassFieldCache classFieldCache)
containingObject - The object containing the field value to serialize.fieldName - The name of the field to serialize.indentWidth - If indentWidth == 0, no prettyprinting indentation is performed, otherwise this specifies the
number of spaces to indent each level of JSON.onlySerializePublicFields - If true, only serialize public fields.classFieldCache - The class field cache. Reusing this cache will increase the speed if many JSON documents of the
same type need to be produced.java.lang.IllegalArgumentException - If anything goes wrong during serialization.public static java.lang.String serializeFromField(java.lang.Object containingObject,
java.lang.String fieldName,
int indentWidth,
boolean onlySerializePublicFields)
containingObject - The object containing the field value to serialize.fieldName - The name of the field to serialize.indentWidth - If indentWidth == 0, no prettyprinting indentation is performed, otherwise this specifies the
number of spaces to indent each level of JSON.onlySerializePublicFields - If true, only serialize public fields.java.lang.IllegalArgumentException - If anything goes wrong during serialization.