A class representing an element of Json. It could either be a JsonObject, a JsonArray, a JsonPrimitive or a JsonNull.
- 作者
- Inderjeet Singh
-
Joel Leitch
| BigDecimal com.google.gson.JsonElement.getAsBigDecimal |
( |
| ) |
|
|
inline |
convenience method to get this element as a BigDecimal.
- 返回
- get this element as a BigDecimal.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive.
|
| NumberFormatException | if the element is not a valid BigDecimal. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
- 自从
- 1.2
| BigInteger com.google.gson.JsonElement.getAsBigInteger |
( |
| ) |
|
|
inline |
convenience method to get this element as a BigInteger.
- 返回
- get this element as a BigInteger.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive. |
| NumberFormatException | if the element is not a valid BigInteger. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
- 自从
- 1.2
| boolean com.google.gson.JsonElement.getAsBoolean |
( |
| ) |
|
|
inline |
convenience method to get this element as a boolean value.
- 返回
- get this element as a primitive boolean value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid boolean value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| Boolean com.google.gson.JsonElement.getAsBooleanWrapper |
( |
| ) |
|
|
inlinepackage |
convenience method to get this element as a Boolean value.
- 返回
- get this element as a Boolean value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid boolean value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| byte com.google.gson.JsonElement.getAsByte |
( |
| ) |
|
|
inline |
convenience method to get this element as a primitive byte value.
- 返回
- get this element as a primitive byte value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid byte value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
- 自从
- 1.3
| char com.google.gson.JsonElement.getAsCharacter |
( |
| ) |
|
|
inline |
convenience method to get this element as a primitive character value.
- 返回
- get this element as a primitive char value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid char value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
- 自从
- 1.3
| double com.google.gson.JsonElement.getAsDouble |
( |
| ) |
|
|
inline |
convenience method to get this element as a primitive double value.
- 返回
- get this element as a primitive double value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid double value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| float com.google.gson.JsonElement.getAsFloat |
( |
| ) |
|
|
inline |
convenience method to get this element as a primitive float value.
- 返回
- get this element as a primitive float value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid float value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| int com.google.gson.JsonElement.getAsInt |
( |
| ) |
|
|
inline |
convenience method to get this element as a primitive integer value.
- 返回
- get this element as a primitive integer value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid integer value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| JsonArray com.google.gson.JsonElement.getAsJsonArray |
( |
| ) |
|
|
inline |
convenience method to get this element as a JsonArray. If the element is of some other type, a ClassCastException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling isJsonArray() first.
- 返回
- get this element as a JsonArray.
- 异常
-
| IllegalStateException | if the element is of another type. |
| JsonNull com.google.gson.JsonElement.getAsJsonNull |
( |
| ) |
|
|
inline |
convenience method to get this element as a JsonNull. If the element is of some other type, a ClassCastException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling isJsonNull() first.
- 返回
- get this element as a JsonNull.
- 异常
-
| IllegalStateException | if the element is of another type. |
- 自从
- 1.2
| JsonObject com.google.gson.JsonElement.getAsJsonObject |
( |
| ) |
|
|
inline |
convenience method to get this element as a JsonObject. If the element is of some other type, a ClassCastException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling isJsonObject() first.
- 返回
- get this element as a JsonObject.
- 异常
-
| IllegalStateException | if the element is of another type. |
convenience method to get this element as a JsonPrimitive. If the element is of some other type, a ClassCastException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling isJsonPrimitive() first.
- 返回
- get this element as a JsonPrimitive.
- 异常
-
| IllegalStateException | if the element is of another type. |
| long com.google.gson.JsonElement.getAsLong |
( |
| ) |
|
|
inline |
convenience method to get this element as a primitive long value.
- 返回
- get this element as a primitive long value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid long value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| Number com.google.gson.JsonElement.getAsNumber |
( |
| ) |
|
|
inline |
convenience method to get this element as a Number.
- 返回
- get this element as a Number.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid number. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| short com.google.gson.JsonElement.getAsShort |
( |
| ) |
|
|
inline |
convenience method to get this element as a primitive short value.
- 返回
- get this element as a primitive short value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid short value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| String com.google.gson.JsonElement.getAsString |
( |
| ) |
|
|
inline |
convenience method to get this element as a string value.
- 返回
- get this element as a string value.
- 异常
-
| ClassCastException | if the element is of not a JsonPrimitive and is not a valid string value. |
| IllegalStateException | if the element is of the type JsonArray but contains more than a single element. |
| boolean com.google.gson.JsonElement.isJsonArray |
( |
| ) |
|
|
inline |
provides check for verifying if this element is an array or not.
- 返回
- true if this element is of type JsonArray, false otherwise.
| boolean com.google.gson.JsonElement.isJsonNull |
( |
| ) |
|
|
inline |
provides check for verifying if this element represents a null value or not.
- 返回
- true if this element is of type JsonNull, false otherwise.
- 自从
- 1.2
| boolean com.google.gson.JsonElement.isJsonObject |
( |
| ) |
|
|
inline |
provides check for verifying if this element is a Json object or not.
- 返回
- true if this element is of type JsonObject, false otherwise.
| boolean com.google.gson.JsonElement.isJsonPrimitive |
( |
| ) |
|
|
inline |
provides check for verifying if this element is a primitive or not.
- 返回
- true if this element is of type JsonPrimitive, false otherwise.
| String com.google.gson.JsonElement.toString |
( |
| ) |
|
|
inline |
Returns a String representation of this element.
该类的文档由以下文件生成: