|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gson.JsonElement
com.google.gson.JsonObject
public final class JsonObject
A class representing an object type in Json. An object consists of name-value pairs where names
are strings, and values are any other type of JsonElement. This allows for a creating a
tree of JsonElements. The member elements of this object are maintained in order they were added.
| Constructor Summary | |
|---|---|
JsonObject()
Creates an empty JsonObject. |
|
| Method Summary | |
|---|---|
void |
add(java.lang.String property,
JsonElement value)
Adds a member, which is a name-value pair, to self. |
void |
addProperty(java.lang.String property,
java.lang.Boolean value)
Convenience method to add a boolean member. |
void |
addProperty(java.lang.String property,
java.lang.Character value)
Convenience method to add a char member. |
void |
addProperty(java.lang.String property,
java.lang.Number value)
Convenience method to add a primitive member. |
void |
addProperty(java.lang.String property,
java.lang.String value)
Convenience method to add a primitive member. |
java.util.Set<java.util.Map.Entry<java.lang.String,JsonElement>> |
entrySet()
Returns a set of members of this object. |
boolean |
equals(java.lang.Object o)
|
JsonElement |
get(java.lang.String memberName)
Returns the member with the specified name. |
JsonArray |
getAsJsonArray(java.lang.String memberName)
Convenience method to get the specified member as a JsonArray. |
JsonObject |
getAsJsonObject(java.lang.String memberName)
Convenience method to get the specified member as a JsonObject. |
JsonPrimitive |
getAsJsonPrimitive(java.lang.String memberName)
Convenience method to get the specified member as a JsonPrimitive element. |
boolean |
has(java.lang.String memberName)
Convenience method to check if a member with the specified name is present in this object. |
int |
hashCode()
|
JsonElement |
remove(java.lang.String property)
Removes the property from this JsonObject. |
| Methods inherited from class com.google.gson.JsonElement |
|---|
getAsBigDecimal, getAsBigInteger, getAsBoolean, getAsByte, getAsCharacter, getAsDouble, getAsFloat, getAsInt, getAsJsonArray, getAsJsonNull, getAsJsonObject, getAsJsonPrimitive, getAsLong, getAsNumber, getAsShort, getAsString, isJsonArray, isJsonNull, isJsonObject, isJsonPrimitive, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JsonObject()
| Method Detail |
|---|
public void add(java.lang.String property,
JsonElement value)
property - name of the member.value - the member object.public JsonElement remove(java.lang.String property)
property from this JsonObject.
property - name of the member that should be removed.
JsonElement object that is being removed.
public void addProperty(java.lang.String property,
java.lang.String value)
property - name of the member.value - the string value associated with the member.
public void addProperty(java.lang.String property,
java.lang.Number value)
property - name of the member.value - the number value associated with the member.
public void addProperty(java.lang.String property,
java.lang.Boolean value)
property - name of the member.value - the number value associated with the member.
public void addProperty(java.lang.String property,
java.lang.Character value)
property - name of the member.value - the number value associated with the member.public java.util.Set<java.util.Map.Entry<java.lang.String,JsonElement>> entrySet()
public boolean has(java.lang.String memberName)
memberName - name of the member that is being checked for presence.
public JsonElement get(java.lang.String memberName)
memberName - name of the member that is being requested.
public JsonPrimitive getAsJsonPrimitive(java.lang.String memberName)
memberName - name of the member being requested.
public JsonArray getAsJsonArray(java.lang.String memberName)
memberName - name of the member being requested.
public JsonObject getAsJsonObject(java.lang.String memberName)
memberName - name of the member being requested.
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||