Package com.adobe.aemds.guide.utils
Class CustomJSONWriter
- java.lang.Object
-
- org.apache.sling.commons.json.io.JSONWriter
-
- com.adobe.aemds.guide.utils.CustomJSONWriter
-
- Direct Known Subclasses:
XFAJSONWriter
public class CustomJSONWriter extends JSONWriter
Extending JSONReader, just to get rid of annoying CheckedException Should not be exported.
-
-
Field Summary
Fields Modifier and Type Field Description java.util.Stack<java.lang.String>
objectStack
-
Constructor Summary
Constructors Constructor Description CustomJSONWriter(java.io.Writer w)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CustomJSONWriter
array()
Begin appending a new array.CustomJSONWriter
endArray()
End an array.CustomJSONWriter
endObject()
End an object.CustomJSONWriter
key(java.lang.String s)
Append a key.CustomJSONWriter
object()
Begin appending a new object.CustomJSONWriter
value(boolean b)
Append either the valuetrue
or the valuefalse
.CustomJSONWriter
value(double d)
Append a double value.CustomJSONWriter
value(long l)
Append a long value.CustomJSONWriter
value(java.lang.Object o)
Append an object value.-
Methods inherited from class org.apache.sling.commons.json.io.JSONWriter
isTidy, setTidy, valueToString, writeArray, writeObject
-
-
-
-
Method Detail
-
array
public CustomJSONWriter array()
Description copied from class:JSONWriter
Begin appending a new array. All values until the balancingendArray
will be appended to this array. TheendArray
method must be called to mark the array's end.- Overrides:
array
in classJSONWriter
- Returns:
- this
-
endArray
public CustomJSONWriter endArray()
Description copied from class:JSONWriter
End an array. This method most be called to balance calls toarray
.- Overrides:
endArray
in classJSONWriter
- Returns:
- this
-
endObject
public CustomJSONWriter endObject()
Description copied from class:JSONWriter
End an object. This method most be called to balance calls toobject
.- Overrides:
endObject
in classJSONWriter
- Returns:
- this
-
key
public CustomJSONWriter key(java.lang.String s)
Description copied from class:JSONWriter
Append a key. The key will be associated with the next value. In an object, every value must be preceded by a key.- Overrides:
key
in classJSONWriter
- Parameters:
s
- A key string.- Returns:
- this
-
object
public CustomJSONWriter object()
Description copied from class:JSONWriter
Begin appending a new object. All keys and values until the balancingendObject
will be appended to this object. TheendObject
method must be called to mark the object's end.- Overrides:
object
in classJSONWriter
- Returns:
- this
-
value
public CustomJSONWriter value(boolean b)
Description copied from class:JSONWriter
Append either the valuetrue
or the valuefalse
.- Overrides:
value
in classJSONWriter
- Parameters:
b
- A boolean.- Returns:
- this
-
value
public CustomJSONWriter value(double d)
Description copied from class:JSONWriter
Append a double value.- Overrides:
value
in classJSONWriter
- Parameters:
d
- A double.- Returns:
- this
-
value
public CustomJSONWriter value(long l)
Description copied from class:JSONWriter
Append a long value.- Overrides:
value
in classJSONWriter
- Parameters:
l
- A long.- Returns:
- this
-
value
public CustomJSONWriter value(java.lang.Object o)
Description copied from class:JSONWriter
Append an object value.- Overrides:
value
in classJSONWriter
- Parameters:
o
- The object to append. It can be null, or a Boolean, Number, String, JSONObject, or JSONArray, or an object that implements JSONString.- Returns:
- this
-
-