public class JsonItemWriter
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.Locale |
DATE_FORMAT_LOCALE
Used to format date values
|
static java.lang.String |
ECMA_DATE_FORMAT
Used to format date values
|
| Constructor and Description |
|---|
JsonItemWriter(java.util.Set<java.lang.String> propertyNamesToIgnore)
Create a JsonItemWriter
|
| Modifier and Type | Method and Description |
|---|---|
void |
dump(NodeIterator it,
java.io.Writer out)
Dump all Nodes of given NodeIterator in JSON
|
protected void |
dump(Node node,
JSONWriter w,
int currentRecursionLevel,
int maxRecursionLevels)
Dump given node in JSON, optionally recursing into its child nodes
|
void |
dump(Node node,
java.io.Writer w,
int maxRecursionLevels)
Dump given node in JSON, optionally recursing into its child nodes
|
void |
dump(Node node,
java.io.Writer w,
int maxRecursionLevels,
boolean tidy)
Dump given node in JSON, optionally recursing into its child nodes
|
void |
dump(Property p,
java.io.Writer w)
Dump given property in JSON
|
protected void |
dumpSingleNode(Node n,
JSONWriter w,
int currentRecursionLevel,
int maxRecursionLevels)
Dump a single node
|
protected void |
dumpValue(JSONWriter w,
Value v)
Writes the given value to the JSON writer.
|
static java.lang.String |
format(java.util.Calendar date) |
protected boolean |
recursionLevelActive(int currentRecursionLevel,
int maxRecursionLevels)
true if the current recursion level is active
|
protected void |
writeProperty(JSONWriter w,
Property p)
Write a single property
|
public static final java.lang.String ECMA_DATE_FORMAT
public static final java.util.Locale DATE_FORMAT_LOCALE
public JsonItemWriter(java.util.Set<java.lang.String> propertyNamesToIgnore)
propertyNamesToIgnore - if not null, a property having a name from
this set of values is ignored. TODO we should use a filtering
interface to make the selection of which Nodes and Properties
to dump more flexible.public void dump(NodeIterator it,
java.io.Writer out)
throws RepositoryException,
JSONException
JSONExceptionRepositoryExceptionpublic void dump(Node node,
java.io.Writer w,
int maxRecursionLevels)
throws RepositoryException,
JSONException
RepositoryExceptionJSONExceptionpublic void dump(Node node,
java.io.Writer w,
int maxRecursionLevels,
boolean tidy)
throws RepositoryException,
JSONException
tidy - if true the json dump is nicely formattedRepositoryExceptionJSONExceptionpublic void dump(Property p,
java.io.Writer w)
throws JSONException,
ValueFormatException,
RepositoryException
JSONExceptionValueFormatExceptionRepositoryExceptionprotected void dump(Node node,
JSONWriter w,
int currentRecursionLevel,
int maxRecursionLevels)
throws RepositoryException,
JSONException
RepositoryExceptionJSONExceptionprotected void dumpSingleNode(Node n,
JSONWriter w,
int currentRecursionLevel,
int maxRecursionLevels)
throws RepositoryException,
JSONException
RepositoryExceptionJSONExceptionprotected boolean recursionLevelActive(int currentRecursionLevel,
int maxRecursionLevels)
protected void writeProperty(JSONWriter w, Property p) throws ValueFormatException, RepositoryException, JSONException
ValueFormatExceptionRepositoryExceptionJSONExceptionprotected void dumpValue(JSONWriter w, Value v) throws ValueFormatException, java.lang.IllegalStateException, RepositoryException, JSONException
| JSR Property Type | JSON Value Type |
|---|---|
| BINARY | always 0 as long |
| DATE | converted date string as defined by ECMA |
| BOOLEAN | boolean |
| LONG | long |
| DOUBLE | double |
| all other | string |
w - json writerv - value to dumpValueFormatExceptionjava.lang.IllegalStateExceptionRepositoryExceptionJSONExceptionpublic static java.lang.String format(java.util.Calendar date)