Interface JsonElement
- All Known Subinterfaces:
JsonObject
public interface JsonElement
A generic element
- Author:
- Riccardo Balbo
-
Method Summary
Modifier and TypeMethodDescription<T extends JsonElement>
TautoCast()Cast this JsonElement to a specific typebooleanReturns the object as a booleanfloatReturns the object as a floatintgetAsInt()Returns the object as an intReturns the object as a JsonArrayReturns the object as a JsonObjectReturns the object as a JsonPrimitiveReturns the object as a NumberReturns the object as a Stringdefault booleanCheck if this element is a JsonArraydefault booleanCheck if this element is a JSON nulldefault booleanCheck if this element is a JsonObjectdefault booleanCheck if this element is a JsonPrimitive
-
Method Details
-
getAsString
-
getAsJsonObject
-
getAsFloat
float getAsFloat()Returns the object as a float- Returns:
- the float
-
getAsInt
int getAsInt()Returns the object as an int- Returns:
- the int
-
getAsBoolean
boolean getAsBoolean()Returns the object as a boolean- Returns:
- the boolean
-
getAsJsonArray
-
getAsNumber
-
getAsJsonPrimitive
JsonPrimitive getAsJsonPrimitive()Returns the object as a JsonPrimitive- Returns:
- the json primitive
-
autoCast
Cast this JsonElement to a specific type- Returns:
- the casted JsonElement
-
isJsonObject
default boolean isJsonObject()Check if this element is a JsonObject- Returns:
- true if this element is a JsonObject, false otherwise
-
isJsonArray
default boolean isJsonArray()Check if this element is a JsonArray- Returns:
- true if this element is a JsonArray, false otherwise
-
isJsonPrimitive
default boolean isJsonPrimitive()Check if this element is a JsonPrimitive- Returns:
- true if this element is a JsonPrimitive, false otherwise
-
isJsonNull
default boolean isJsonNull()Check if this element is a JSON null- Returns:
- true if this element represents a null value, false otherwise
-