Enum Class JSType
- All Implemented Interfaces:
Serializable
,Comparable<JSType>
,Constable
Represents the types possible in a JSON encoding.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic Number
getAsNumber
(com.inductiveautomation.ignition.common.gson.JsonPrimitive element) This is a utility method that only exists because of an oddity in the GSON implementation.boolean
static JSType
static JSType
ofElement
(com.inductiveautomation.ignition.common.gson.JsonElement e) static JSType
static Object
toJava
(com.inductiveautomation.ignition.common.gson.JsonPrimitive element) Converts a json primitive to the best representation for java (Number, Boolean or String)com.inductiveautomation.ignition.common.gson.JsonElement
toJsonPrimitive
(Object value) static JSType
Returns the enum constant of this class with the specified name.static JSType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
Number
-
String
-
Boolean
-
Null
-
Object
-
Array
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
isPrimitive
public boolean isPrimitive() -
ofElement
-
ofObject
-
ofClass
-
toJsonPrimitive
-
getAsNumber
public static Number getAsNumber(com.inductiveautomation.ignition.common.gson.JsonPrimitive element) This is a utility method that only exists because of an oddity in the GSON implementation. When GSON parses a number, it represents it as a LazilyParsedNumber. In many cases, we do not want one of these numbers, we want a more traditional subclass of Number like Double or Long. This method helps figure out which kind of number an element should really be and retrns that instead. -
toJava
Converts a json primitive to the best representation for java (Number, Boolean or String)
-