public class OAJsonWriter extends Object
OAJsonReader
Modifier and Type | Field and Description |
---|---|
protected Hashtable |
hash |
int |
indent |
int |
indentAmount |
protected PrintWriter |
pw |
protected StringWriter |
sw |
Constructor and Description |
---|
OAJsonWriter() |
Modifier and Type | Method and Description |
---|---|
String |
convertToString(String property,
Object value)
Method that can be overwritten to provide custom conversion to String.
|
void |
excludePropertyPath(String propertyPath) |
boolean |
getCompress() |
protected String |
getCurrentPath()
Current propertyPath from the root OAObject.
|
void |
includeManyReferences(boolean b) |
void |
includeOneReferences(boolean b) |
void |
includePropertyPath(String propertyPath) |
void |
indent() |
void |
popReference() |
void |
print(String line) |
void |
printCDATA(String line)
encloses line in XML CDATA tag and internally encodes illegal XML characters
|
void |
printJson(String line)
converts XML codes and encodes illegal XML characters
|
void |
println(String line) |
void |
pushReference(String name) |
protected void |
reset() |
void |
setCompress(boolean b) |
boolean |
shouldIncludeProperty(Object obj,
String propertyName,
Object value,
OAPropertyInfo pi,
OALinkInfo li)
called by OAObject.write to know if object should
be written for a property that references another OAObject.
|
String |
write(Hub hub)
saves Hub as JSON
|
String |
write(OAObject obj)
saves OAObject as JSON
|
void |
writing(Object obj)
hook used to know when an object is being saved.
|
protected PrintWriter pw
protected StringWriter sw
public int indent
public int indentAmount
protected Hashtable hash
public void setCompress(boolean b)
public boolean getCompress()
protected void reset()
public boolean shouldIncludeProperty(Object obj, String propertyName, Object value, OAPropertyInfo pi, OALinkInfo li)
protected String getCurrentPath()
public void pushReference(String name)
public void popReference()
public void includeOneReferences(boolean b)
public void includeManyReferences(boolean b)
public void includePropertyPath(String propertyPath)
public void excludePropertyPath(String propertyPath)
public void writing(Object obj)
public void printCDATA(String line)
public void printJson(String line)
public void print(String line)
public void println(String line)
public void indent()
Copyright © 1999–2019 ViaOA. All rights reserved.