|
ICEfaces ACE Components 3.3.0 Java API Documentation |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.icefaces.ace.util.JSONBuilder
public class JSONBuilder
Utility API that builds the parameter strings, performs param escaping. Output is a JSON string as specified at json.org. Based on spec. from Mark Collette and code from YUI. List of escaped characters can be found at json.org.
Constructor Summary | |
---|---|
JSONBuilder()
|
Method Summary | |
---|---|
JSONBuilder |
beginArray()
Begins an anonymous array. |
JSONBuilder |
beginArray(java.lang.String key)
|
JSONBuilder |
beginFunction(java.lang.String name)
|
JSONBuilder |
beginMap()
Begins an anonymous object. |
JSONBuilder |
beginMap(java.lang.String key)
Begins a named object. |
static JSONBuilder |
create()
Makes a new instance of JSONBuilder. |
JSONBuilder |
endArray()
|
JSONBuilder |
endFunction()
|
JSONBuilder |
endMap()
Ends an object. |
JSONBuilder |
entry(java.lang.String key,
boolean value)
Adds a boolean property to a map. |
JSONBuilder |
entry(java.lang.String key,
double value)
Adds a double property to a map. |
JSONBuilder |
entry(java.lang.String key,
float value)
Adds a float property to a map. |
JSONBuilder |
entry(java.lang.String key,
int value)
Adds an int property to a map. |
JSONBuilder |
entry(java.lang.String key,
long value)
Adds a long property to a map. |
JSONBuilder |
entry(java.lang.String key,
java.lang.String value)
Adds a String property to a map. |
JSONBuilder |
entry(java.lang.String key,
java.lang.String[] keyValuePairs)
Append a key bound String array that is itself a set of key-value pairs to a map. |
JSONBuilder |
entry(java.lang.String key,
java.lang.String value,
boolean isStringLiteral)
Adds a String property as String literal optionally to a map. |
JSONBuilder |
entryNonNullValue(java.lang.String key,
java.lang.Boolean value)
Adds a Boolean property to a map only if the value is non-null, otherwise the key/value pair will not be added at all. |
JSONBuilder |
entryNonNullValue(java.lang.String key,
java.lang.Double value)
Adds a Double property to a map only if the value is non-null, otherwise the key/value pair will not be added at all. |
JSONBuilder |
entryNonNullValue(java.lang.String key,
java.lang.Float value)
Adds a Float property to a map only if the value is non-null, otherwise the key/value pair will not be added at all. |
JSONBuilder |
entryNonNullValue(java.lang.String key,
java.lang.Integer value)
Adds an Integer property to a map only if the value is non-null, otherwise the key/value pair will not be added at all. |
JSONBuilder |
entryNonNullValue(java.lang.String key,
java.lang.Long value)
Adds a Long property to a map only if the value is non-null, otherwise the key/value pair will not be added at all. |
JSONBuilder |
entryNonNullValue(java.lang.String key,
java.lang.String value)
Adds a String property to a map only if the value is non-null, otherwise the key/value pair will not be added at all. |
static java.lang.String |
escapeString(java.lang.String value)
|
JSONBuilder |
initialiseVar(java.lang.String varName)
|
JSONBuilder |
initialiseWindowVar(java.lang.String varName)
|
JSONBuilder |
item(boolean value)
Adds a boolean to an array or function call. |
JSONBuilder |
item(double value)
Adds a double to an array or function call. |
JSONBuilder |
item(float value)
Adds a float to an array or function call. |
JSONBuilder |
item(int value)
Adds an int to an array or function call. |
JSONBuilder |
item(long value)
Adds a long to an array or function call. |
JSONBuilder |
item(java.lang.String value)
Adds an escaped String to an array or function call. |
JSONBuilder |
item(java.lang.String value,
boolean escaped)
Adds a String to an array or function call. |
java.lang.String |
toString()
Outputs the JSON string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JSONBuilder()
Method Detail |
---|
public static JSONBuilder create()
public JSONBuilder initialiseVar(java.lang.String varName)
public JSONBuilder initialiseWindowVar(java.lang.String varName)
public JSONBuilder beginMap()
public JSONBuilder beginMap(java.lang.String key)
key
- name of the object.
public JSONBuilder endMap()
public JSONBuilder beginArray()
public JSONBuilder beginArray(java.lang.String key)
public JSONBuilder endArray()
public JSONBuilder beginFunction(java.lang.String name)
public JSONBuilder endFunction()
public JSONBuilder entry(java.lang.String key, int value)
key
- name of the property.value
- value of the property.
public JSONBuilder entry(java.lang.String key, long value)
key
- name of the property.value
- value of the property.
public JSONBuilder entry(java.lang.String key, float value)
key
- name of the property.value
- value of the property.
public JSONBuilder entry(java.lang.String key, double value)
key
- name of the property.value
- value of the property.
public JSONBuilder entry(java.lang.String key, boolean value)
key
- name of the property.value
- value of the property.
public JSONBuilder entry(java.lang.String key, java.lang.String[] keyValuePairs)
key
- overall key to put entry underkeyValuePairs
- Array of key value pair string entries
public JSONBuilder entryNonNullValue(java.lang.String key, java.lang.Integer value)
key
- name of the property.value
- value of the property.
public JSONBuilder entryNonNullValue(java.lang.String key, java.lang.Long value)
key
- name of the property.value
- value of the property.
public JSONBuilder entryNonNullValue(java.lang.String key, java.lang.Float value)
key
- name of the property.value
- value of the property.
public JSONBuilder entryNonNullValue(java.lang.String key, java.lang.Double value)
key
- name of the property.value
- value of the property.
public JSONBuilder entryNonNullValue(java.lang.String key, java.lang.Boolean value)
key
- name of the property.value
- value of the property.
public JSONBuilder entryNonNullValue(java.lang.String key, java.lang.String value)
key
- name of the property.value
- value of the property.
public JSONBuilder entry(java.lang.String key, java.lang.String value)
key
- name of the property.value
- value of the property.
public JSONBuilder entry(java.lang.String key, java.lang.String value, boolean isStringLiteral)
key
- name of the property.value
- value of the property.
public JSONBuilder item(int value)
value
- value of the item.
public JSONBuilder item(long value)
value
- value of the item.
public JSONBuilder item(float value)
value
- value of the item.
public JSONBuilder item(double value)
value
- value of the item.
public JSONBuilder item(boolean value)
value
- value of the item.
public JSONBuilder item(java.lang.String value)
value
- value of the item.
public JSONBuilder item(java.lang.String value, boolean escaped)
value
- value of the item.
public static java.lang.String escapeString(java.lang.String value)
public java.lang.String toString()
toString
in class java.lang.Object
|
ICEfaces ACE Components 3.3.0 Java API Documentation |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |