Package com.day.cq.commons
Class TidyJsonItemWriter
java.lang.Object
org.apache.sling.commons.json.jcr.JsonItemWriter
com.day.cq.commons.TidyJsonItemWriter
- Direct Known Subclasses:
SitecatalystJsonItemWriter
Extension of the JsonItemWriter that uses a
TidyJSONWriter
.-
Field Summary
Fields inherited from class org.apache.sling.commons.json.jcr.JsonItemWriter
DATE_FORMAT_LOCALE, ECMA_DATE_FORMAT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump
(NodeIterator it, Writer out) Dump all Nodes of given NodeIterator in JSONvoid
dump
(NodeIterator it, JSONWriter w) Dump all Nodes of given NodeIterator in JSONvoid
Dump given node in JSON, optionally recursing into its child nodesvoid
dump
(Node node, JSONWriter w, int maxRecursionLevels) Dump given node in JSON, optionally recursing into its child nodesvoid
Dump given property in JSONvoid
dump
(Property p, JSONWriter w) Dump the property in JSONboolean
isTidy()
Checks if the output is nicely formatted.void
setTidy
(boolean tidy) Controls if output should be nicely formatted.Methods inherited from class org.apache.sling.commons.json.jcr.JsonItemWriter
dump, format
-
Constructor Details
-
TidyJsonItemWriter
Constructor- Parameters:
propertyNamesToIgnore
- See javadoc of constructor ofJsonItemWriter
-
-
Method Details
-
isTidy
public boolean isTidy()Checks if the output is nicely formatted.- Returns:
true
if nicely formatted
-
setTidy
public void setTidy(boolean tidy) Controls if output should be nicely formatted.- Parameters:
tidy
-true
to nicely format.
-
dump
public void dump(Node node, JSONWriter w, int maxRecursionLevels) throws RepositoryException, JSONException Dump given node in JSON, optionally recursing into its child nodes- Parameters:
node
- node to dumpw
-JSONWriter
maxRecursionLevels
- max recursion level- Throws:
RepositoryException
- if some error occursJSONException
- if some error occurs
-
dump
public void dump(Node node, Writer w, int maxRecursionLevels) throws RepositoryException, JSONException Dump given node in JSON, optionally recursing into its child nodes- Overrides:
dump
in classJsonItemWriter
- Throws:
RepositoryException
JSONException
-
dump
Dump all Nodes of given NodeIterator in JSON- Parameters:
it
-NodeIterator
w
-JSONWriter
- Throws:
RepositoryException
- if some error occursJSONException
- if some error occurs
-
dump
Dump all Nodes of given NodeIterator in JSON- Overrides:
dump
in classJsonItemWriter
- Throws:
JSONException
RepositoryException
-
dump
Dump the property in JSON- Parameters:
p
- property to dumpw
-JSONWriter
- Throws:
RepositoryException
- if some error occursJSONException
- if some error occurs
-
dump
public void dump(Property p, Writer w) throws JSONException, ValueFormatException, RepositoryException Dump given property in JSON- Overrides:
dump
in classJsonItemWriter
- Throws:
JSONException
ValueFormatException
RepositoryException
-