JsonElement Class
- java.
lang. Object - com.
azure. json. models. JsonElement
- com.
Implements
public abstract class JsonElement
implements JsonSerializable<JsonElement>
Interface defining methods that all JSON types must implement.
Constructor Summary
| Constructor | Description |
|---|---|
| JsonElement() |
Default constructor. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Json |
asArray()
Casts the element to an array. |
|
Json |
asBoolean()
Casts the element to a boolean. |
|
Json |
asNull()
Casts the element to a null. |
|
Json |
asNumber()
Casts the element to a number. |
|
Json |
asObject()
Casts the element to an object. |
|
Json |
asString()
Casts the element to a string. |
| boolean |
isArray()
Indicates whether the element is an array. |
| boolean |
isBoolean()
Indicates whether the element is a boolean. |
| boolean |
isNull()
Indicates whether the element is a null. |
| boolean |
isNumber()
Indicates whether the element is a number. |
| boolean |
isObject()
Indicates whether the element is an object. |
| boolean |
isString()
Indicates whether the element is a string. |
Methods inherited from java.lang.Object
Constructor Details
JsonElement
public JsonElement()
Default constructor.
Method Details
asArray
public JsonArray asArray()
Casts the element to an array.
If isArray() returns false, this will throw a ClassCastException.
Returns:
asBoolean
public JsonBoolean asBoolean()
Casts the element to a boolean.
If isBoolean() returns false, this will throw a ClassCastException.
Returns:
asNull
public JsonNull asNull()
Casts the element to a null.
If isNull() returns false, this will throw a ClassCastException.
Returns:
asNumber
public JsonNumber asNumber()
Casts the element to a number.
If isNumber() returns false, this will throw a ClassCastException.
Returns:
asObject
public JsonObject asObject()
Casts the element to an object.
If isObject() returns false, this will throw a ClassCastException.
Returns:
asString
public JsonString asString()
Casts the element to a string.
If isString() returns false, this will throw a ClassCastException.
Returns:
isArray
public boolean isArray()
Indicates whether the element is an array.
Returns:
isBoolean
public boolean isBoolean()
Indicates whether the element is a boolean.
Returns:
isNull
public boolean isNull()
Indicates whether the element is a null.
Returns:
isNumber
public boolean isNumber()
Indicates whether the element is a number.
Returns:
isObject
public boolean isObject()
Indicates whether the element is an object.
Returns:
isString
public boolean isString()
Indicates whether the element is a string.
Returns: