Class JsonObject
java.lang.Object
name.martingeisse.grumpyjson.json_model.JsonElement
name.martingeisse.grumpyjson.json_model.JsonObject
This class represents JSON objects.
-
Method Summary
Modifier and TypeMethodDescriptionfinal Map<String,JsonElement> If this JSON element is not a JSON object, this method throws aJsonDeserializationException, otherwise it returns the array's elements as aMap.booleanabstract Map<String,JsonElement> getAsMap()Returns the properties of this JSON object as aMap.inthashCode()static JsonObjectof()Creates an empty instance of this class.static JsonObjectof(String key1, JsonElement value1) Creates an instance of this class from one directly specified key/value pair.static JsonObjectof(String key1, JsonElement value1, String key2, JsonElement value2) Creates an instance of this class from two directly specified key/value pairs.static JsonObjectof(String key1, JsonElement value1, String key2, JsonElement value2, String key3, JsonElement value3) Creates an instance of this class from three directly specified key/value pairs.static JsonObjectof(Map<String, JsonElement> properties) Creates an instance of this class from aMapcontaining the properties of the JSON object.toString()Methods inherited from class name.martingeisse.grumpyjson.json_model.JsonElement
deserializerExpectsArray, deserializerExpectsBoolean, deserializerExpectsNull, deserializerExpectsNumber, deserializerExpectsString
-
Method Details
-
of
Creates an instance of this class from aMapcontaining the properties of the JSON object.- Parameters:
properties- the properties of the JSON object to create- Returns:
- the JSON object
-
of
Creates an empty instance of this class.- Returns:
- the JSON object
-
of
Creates an instance of this class from one directly specified key/value pair.- Parameters:
key1- the first property keyvalue1- the first property value- Returns:
- the JSON object
-
of
Creates an instance of this class from two directly specified key/value pairs.- Parameters:
key1- the first property keyvalue1- the first property valuekey2- the second property keyvalue2- the second property value- Returns:
- the JSON object
-
of
public static JsonObject of(String key1, JsonElement value1, String key2, JsonElement value2, String key3, JsonElement value3) Creates an instance of this class from three directly specified key/value pairs.- Parameters:
key1- the first property keyvalue1- the first property valuekey2- the second property keyvalue2- the second property valuekey3- the second property keyvalue3- the second property value- Returns:
- the JSON object
-
getAsMap
Returns the properties of this JSON object as aMap.- Returns:
- the properties
-
deserializerExpectsObject
Description copied from class:JsonElementIf this JSON element is not a JSON object, this method throws aJsonDeserializationException, otherwise it returns the array's elements as aMap.- Overrides:
deserializerExpectsObjectin classJsonElement- Returns:
- the property map
-
equals
-
hashCode
public int hashCode() -
toString
-