public class JsonItemWriter extends Object
Modifier and Type | Field and Description |
---|---|
static Locale |
DATE_FORMAT_LOCALE
Used to format date values
|
static String |
ECMA_DATE_FORMAT
Used to format date values
|
Constructor and Description |
---|
JsonItemWriter(Set<String> propertyNamesToIgnore)
Create a JsonItemWriter
|
Modifier and Type | Method and Description |
---|---|
void |
dump(javax.jcr.NodeIterator it,
Writer out)
Dump all Nodes of given NodeIterator in JSON
|
protected void |
dump(javax.jcr.Node node,
JSONWriter w,
int currentRecursionLevel,
int maxRecursionLevels)
Dump given node in JSON, optionally recursing into its child nodes
|
void |
dump(javax.jcr.Node node,
Writer w,
int maxRecursionLevels)
Dump given node in JSON, optionally recursing into its child nodes
|
void |
dump(javax.jcr.Node node,
Writer w,
int maxRecursionLevels,
boolean tidy)
Dump given node in JSON, optionally recursing into its child nodes
|
void |
dump(javax.jcr.Property p,
Writer w)
Dump given property in JSON
|
protected void |
dumpSingleNode(javax.jcr.Node n,
JSONWriter w,
int currentRecursionLevel,
int maxRecursionLevels)
Dump a single node
|
protected void |
dumpValue(JSONWriter w,
javax.jcr.Value v)
Writes the given value to the JSON writer.
|
static String |
format(Calendar date) |
protected boolean |
recursionLevelActive(int currentRecursionLevel,
int maxRecursionLevels)
true if the current recursion level is active
|
protected void |
writeProperty(JSONWriter w,
javax.jcr.Property p)
Write a single property
|
public static final String ECMA_DATE_FORMAT
public static final Locale DATE_FORMAT_LOCALE
public JsonItemWriter(Set<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(javax.jcr.NodeIterator it, Writer out) throws javax.jcr.RepositoryException, JSONException
JSONException
javax.jcr.RepositoryException
public void dump(javax.jcr.Node node, Writer w, int maxRecursionLevels) throws javax.jcr.RepositoryException, JSONException
javax.jcr.RepositoryException
JSONException
public void dump(javax.jcr.Node node, Writer w, int maxRecursionLevels, boolean tidy) throws javax.jcr.RepositoryException, JSONException
tidy
- if true
the json dump is nicely formattedjavax.jcr.RepositoryException
JSONException
public void dump(javax.jcr.Property p, Writer w) throws JSONException, javax.jcr.ValueFormatException, javax.jcr.RepositoryException
JSONException
javax.jcr.ValueFormatException
javax.jcr.RepositoryException
protected void dump(javax.jcr.Node node, JSONWriter w, int currentRecursionLevel, int maxRecursionLevels) throws javax.jcr.RepositoryException, JSONException
javax.jcr.RepositoryException
JSONException
protected void dumpSingleNode(javax.jcr.Node n, JSONWriter w, int currentRecursionLevel, int maxRecursionLevels) throws javax.jcr.RepositoryException, JSONException
javax.jcr.RepositoryException
JSONException
protected boolean recursionLevelActive(int currentRecursionLevel, int maxRecursionLevels)
protected void writeProperty(JSONWriter w, javax.jcr.Property p) throws javax.jcr.ValueFormatException, javax.jcr.RepositoryException, JSONException
javax.jcr.ValueFormatException
javax.jcr.RepositoryException
JSONException
protected void dumpValue(JSONWriter w, javax.jcr.Value v) throws javax.jcr.ValueFormatException, IllegalStateException, javax.jcr.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 dumpjavax.jcr.ValueFormatException
IllegalStateException
javax.jcr.RepositoryException
JSONException
Copyright © 2014 The Apache Software Foundation. All rights reserved.