Class JsonJcrNode
java.lang.Object
org.apache.sling.commons.json.JSONObject
org.apache.sling.commons.json.jcr.JsonJcrNode
Deprecated.
This class makes it easy to create a JSON object out of a JCR node. It is a
shameless copy of
JsonItemWriter
,
but instead of writing the resulting JSON directly to an output, you get a
JSONObject that you can deal with.- Since:
- Apr 17, 2009 6:55:30 PM
- Author:
- vidar@idium.no
-
Field Summary
Fields inherited from class org.apache.sling.commons.json.JSONObject
NULL, NUMBER_PATTERN
-
Constructor Summary
ConstructorsConstructorDescriptionJsonJcrNode
(javax.jcr.Node node) Deprecated.Creates a JSONObject out ofnode
.JsonJcrNode
(javax.jcr.Node node, Set<String> propertyNamesToIgnore) Deprecated.Creates aJSONObject
out ofnode
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addProperty
(javax.jcr.Property p) Deprecated.protected void
Deprecated.Methods inherited from class org.apache.sling.commons.json.JSONObject
accumulate, append, clear, doubleToString, entrySet, get, getBigDecimal, getBigInteger, getBoolean, getDouble, getEnum, getFloat, getInt, getJSONArray, getJSONObject, getLong, getMapType, getNames, getNames, getNumber, getString, has, increment, isDecimalNotation, isEmpty, isNull, keys, keySet, length, names, numberToString, opt, optBigDecimal, optBigInteger, optBoolean, optBoolean, optBooleanObject, optBooleanObject, optDouble, optDouble, optDoubleObject, optDoubleObject, optEnum, optEnum, optFloat, optFloat, optFloatObject, optFloatObject, optInt, optInt, optIntegerObject, optIntegerObject, optJSONArray, optJSONArray, optJSONObject, optJSONObject, optLong, optLong, optLongObject, optLongObject, optNumber, optNumber, optQuery, optQuery, optString, optString, put, put, put, put, put, put, put, put, putOnce, putOpt, query, query, quote, quote, remove, similar, stringToNumber, stringToValue, testValidity, toJSONArray, toMap, toString, toString, valueToString, wrap, write, write
-
Constructor Details
-
JsonJcrNode
Deprecated.Creates a JSONObject out ofnode
. Allnode
's properties will be reflected in the JSON object. In addition, propertiesjcr:path
andjcr:name
are added. Their values are those returned bynode.getPath()
andnode.getName()
, respectively.- Parameters:
node
- The JCR node to use- Throws:
JSONException
- If there's a problem generating the JSON objectjavax.jcr.RepositoryException
- If there's a problem reading data from the JCR repository
-
JsonJcrNode
public JsonJcrNode(javax.jcr.Node node, Set<String> propertyNamesToIgnore) throws JSONException, javax.jcr.RepositoryException Deprecated.Creates aJSONObject
out ofnode
. Allnode
's properties will be reflected in the JSON object, except those inpropertyNamesToIgnore
. In addition, propertiesjcr:path
andjcr:name
are added. Their values are those returned bynode.getPath()
andnode.getName()
, respectively.- Parameters:
node
- The JCR node to usepropertyNamesToIgnore
- A set of property names that should not be reflected in the resulting JSON object.- Throws:
JSONException
- If there's a problem generating the JSON objectjavax.jcr.RepositoryException
- If there's a problem reading data from the JCR repository
-
-
Method Details
-
addProperty
protected void addProperty(javax.jcr.Property p) throws javax.jcr.ValueFormatException, javax.jcr.RepositoryException, JSONException Deprecated.- Throws:
javax.jcr.ValueFormatException
javax.jcr.RepositoryException
JSONException
-
addValue
protected void addValue(String key, javax.jcr.Value v) throws IllegalStateException, javax.jcr.RepositoryException, JSONException Deprecated.- Throws:
IllegalStateException
javax.jcr.RepositoryException
JSONException
-