|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.sling.servlets.get.impl.helpers.JsonResourceWriter
public class JsonResourceWriter
Dumps JCR Items as JSON data. The dump methods are threadsafe. Dump can be done on the Resource, property or value level.
Field Summary | |
---|---|
static Locale |
DATE_FORMAT_LOCALE
Used to format date values |
static String |
ECMA_DATE_FORMAT
Used to format date values |
Constructor Summary | |
---|---|
JsonResourceWriter(Set<String> propertyNamesToIgnore)
Create a JsonItemWriter |
Method Summary | |
---|---|
protected void |
dump(Resource resource,
JSONWriter w,
int currentRecursionLevel,
int maxRecursionLevels)
Dump given resource in JSON, optionally recursing into its objects |
void |
dump(Resource resource,
Writer w,
int maxRecursionLevels)
Dump given resource in JSON, optionally recursing into its object |
void |
dump(Resource resource,
Writer w,
int maxRecursionLevels,
boolean tidy)
Dump given resource in JSON, optionally recursing into its objects |
void |
dumpProperties(Resource resource,
JSONWriter w,
List<String> properties)
Dump only a subset of the resource properties |
protected void |
dumpSingleResource(Resource n,
JSONWriter w,
int currentRecursionLevel,
int maxRecursionLevels)
Dump a single node |
void |
dumpValue(JSONWriter w,
Object value)
Dump only a value in the correct format |
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,
ValueMap valueMap,
String key,
Object value)
Write a single property |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ECMA_DATE_FORMAT
public static final Locale DATE_FORMAT_LOCALE
Constructor Detail |
---|
public JsonResourceWriter(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.Method Detail |
---|
public void dump(Resource resource, Writer w, int maxRecursionLevels) throws JSONException
JSONException
public void dump(Resource resource, Writer w, int maxRecursionLevels, boolean tidy) throws JSONException
tidy
- if true
the json dump is nicely formatted
JSONException
protected void dump(Resource resource, JSONWriter w, int currentRecursionLevel, int maxRecursionLevels) throws JSONException
JSONException
public void dumpProperties(Resource resource, JSONWriter w, List<String> properties) throws JSONException
JSONException
public void dumpValue(JSONWriter w, Object value) throws JSONException
JSONException
protected void dumpSingleResource(Resource n, JSONWriter w, int currentRecursionLevel, int maxRecursionLevels) throws JSONException
JSONException
protected boolean recursionLevelActive(int currentRecursionLevel, int maxRecursionLevels)
protected void writeProperty(JSONWriter w, ValueMap valueMap, String key, Object value) throws JSONException
JSONException
public static String format(Calendar date)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |