Modifier and Type | Field and Description |
---|---|
protected Map<String,?> |
m_mappedProperties |
protected int |
m_maxDepth |
protected Collection<String> |
m_skippedProperties |
Constructor and Description |
---|
JSONSerializer() |
JSONSerializer(Map<String,?> mappedProperties) |
JSONSerializer(Map<String,?> mappedProperties,
Collection<String> skippedProperties) |
Modifier and Type | Method and Description |
---|---|
Map<String,?> |
getMappedProperties()
Map of original property-names to re-mapped property-names.
|
int |
getMaxDepth()
Max depth to recurse into objects.
|
Collection<String> |
getSkippedProperties()
Set of original property-names to skip
(in addition to any null re-mapped names).
|
void |
serialize(Object o,
Appendable b)
Serializes specified object to specified appendable buffer.
|
void |
serialize(Object o,
Appendable b,
List<Object> stack)
Serializes specified object to specified appendable buffer.
|
boolean |
serializeContent(Object o,
Appendable b,
List<Object> stack)
Serializes the content of the specified map, list, or array
(sans brackets) to the appendable buffer.
|
void |
serializeSecure(Object o,
Appendable b)
Serializes object within prototype-compatible "secure" comment
(ie "/*-secure-{}*/") to the appendable buffer.
|
void |
setMappedProperties(Map<String,?> mappedProperties)
Map of original property-names to re-mapped property-names.
|
void |
setMaxDepth(int maxDepth)
Max depth to recurse into objects.
|
void |
setSkippedProperties(Collection<String> skippedProperties)
Set of original property-names to skip
(in addition to any null re-mapped names).
|
protected void |
writePropertyName(Object o,
Appendable b)
Writes the specified property name and colon to the appendable buffer
(ie "foo:" or "'foo bar':").
|
protected int m_maxDepth
protected Collection<String> m_skippedProperties
public JSONSerializer()
public JSONSerializer(Map<String,?> mappedProperties, Collection<String> skippedProperties)
public void serialize(Object o, Appendable b) throws IOException
o
- Object to serialize.b
- Buffer.IOException
public void serialize(Object o, Appendable b, List<Object> stack) throws IOException
o
- Object to serialize.b
- Buffer.stack
- Stack of objects already serialized (if null, lazily init'd).IOException
public void serializeSecure(Object o, Appendable b) throws IOException
o
- Object to serialize.b
- Buffer.IOException
public boolean serializeContent(Object o, Appendable b, List<Object> stack) throws IOException
map
- Object to serialize.b
- Buffer.stack
- Stack of objects already serialized (if null, lazily init'd).IOException
protected void writePropertyName(Object o, Appendable b) throws IOException
o
- Property name.b
- Buffer.IOException
public Map<String,?> getMappedProperties()
public void setMappedProperties(Map<String,?> mappedProperties)
public Collection<String> getSkippedProperties()
public void setSkippedProperties(Collection<String> skippedProperties)
public int getMaxDepth()
public void setMaxDepth(int maxDepth)