|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.yworks.yfiles.server.tiles.support.JSONStringBuilder
This class can be used to build a string which represents an object in JSON format.
There are several addMember
methods for adding members of different types.
getJSONString()
returns a JSON string containing all the members which were
added before.
Constructor Summary | |
JSONStringBuilder()
creates a new instance representing an empty JSON object. |
Method Summary | |
void |
addMember(String key,
boolean value)
adds a new member with a boolean value to the object represented by the string available via getJSONString() . |
void |
addMember(String key,
double value)
adds a new member with a double value to the object represented by the string available via getJSONString() . |
void |
addMember(String key,
int value)
adds a new member with an integer value to the object represented by the string available via getJSONString() . |
void |
addMember(String key,
Rectangle value)
adds a new member with a rectangle value to the object represented by the string available via getJSONString() . |
void |
addMember(String key,
String value)
performs addMember(key, value, true, true) . |
void |
addMember(String key,
String value,
boolean escapeString,
boolean addQuotes)
adds a member to the object represented by the string available via getJSONString() . |
void |
addMember(String key,
YPoint value)
adds a new member with a point value to the object represented by the string available via getJSONString() . |
String |
getJSONString()
returns the string in JSON format for an object with all the members added by addMember calls. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JSONStringBuilder()
Method Detail |
public void addMember(String key, String value, boolean escapeString, boolean addQuotes)
getJSONString()
.
Whether the string value of the member gets escaped and/or quoted is configurable. If a member
for the same key has been added before it gets overridden. The key string gets escaped in any case.
key
- the key for the new membervalue
- the value for the new memberescapeString
- whether to escape the valueaddQuotes
- whether to add quotes to the valueJSONSupport.escapeString(String)
,
JSONSupport.escapeStringNoQuotes(String)
public void addMember(String key, String value)
addMember(key, value, true, true)
.
key
- the key for the new membervalue
- the value for the new memberaddMember(String, String, boolean, boolean)
public void addMember(String key, Rectangle value)
getJSONString()
. The string for the value is constructed using
JSONSupport.rectangleString(Rectangle)
. The key string gets escaped.
key
- the key for the new membervalue
- the rectangle valuepublic void addMember(String key, YPoint value)
getJSONString()
. The string for the value is constructed using
JSONSupport.pointString(YPoint)
. The key string gets escaped.
key
- the key for the new membervalue
- the point valuepublic void addMember(String key, boolean value)
getJSONString()
. The key string gets escaped.
key
- the key for the new membervalue
- the valuepublic void addMember(String key, int value)
getJSONString()
. The key string gets escaped.
key
- the key for the new membervalue
- the valuepublic void addMember(String key, double value)
getJSONString()
. The key string gets escaped.
key
- the key for the new membervalue
- the valuepublic String getJSONString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |