Enum JSType
- java.lang.Object
-
- java.lang.Enum<JSType>
-
- com.inductiveautomation.ignition.common.JSType
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.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
isPrimitive()
static JSType
ofClass(java.lang.Class<?> clazz)
static JSType
ofElement(com.inductiveautomation.ignition.common.gson.JsonElement e)
static JSType
ofObject(java.lang.Object object)
static java.lang.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(java.lang.Object value)
static JSType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static JSType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static JSType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (JSType c : JSType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static JSType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
isPrimitive
public boolean isPrimitive()
-
ofElement
public static JSType ofElement(com.inductiveautomation.ignition.common.gson.JsonElement e)
-
ofObject
public static JSType ofObject(java.lang.Object object)
-
ofClass
public static JSType ofClass(java.lang.Class<?> clazz)
-
toJsonPrimitive
public com.inductiveautomation.ignition.common.gson.JsonElement toJsonPrimitive(java.lang.Object value)
-
getAsNumber
public static java.lang.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
public static java.lang.Object toJava(com.inductiveautomation.ignition.common.gson.JsonPrimitive element)
Converts a json primitive to the best representation for java (Number, Boolean or String)
-
-