- java.lang.Object
-
- java.lang.Enum<InstanceType>
-
- org.leadpony.justify.api.InstanceType
-
- All Implemented Interfaces:
Serializable,Comparable<InstanceType>
public enum InstanceType extends Enum<InstanceType>
The primitive types of JSON instances.- Author:
- leadpony
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisContainer()Checks if this type can contain other types or not.booleanisNumeric()Checks if this type is numeric or not.static InstanceTypeof(JsonValue value)Returns the type of the specified JSON value.static InstanceTypevalueOf(String name)Returns the enum constant of this type with the specified name.static InstanceType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NULL
public static final InstanceType NULL
JSON null.
-
BOOLEAN
public static final InstanceType BOOLEAN
JSON true of false.
-
OBJECT
public static final InstanceType OBJECT
JSON object.
-
ARRAY
public static final InstanceType ARRAY
JSON array.
-
NUMBER
public static final InstanceType NUMBER
JSON number with or without fractional part.
-
STRING
public static final InstanceType STRING
JSON object.
-
INTEGER
public static final InstanceType INTEGER
JSON number without fractional part.
-
-
Method Detail
-
values
public static InstanceType[] 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 (InstanceType c : InstanceType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static InstanceType valueOf(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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
isNumeric
public boolean isNumeric()
Checks if this type is numeric or not.- Returns:
trueif this type is numeric,falseotherwise.
-
isContainer
public boolean isContainer()
Checks if this type can contain other types or not. A container is either JSON array or JSON object.- Returns:
trueif this type is container,falseotherwise.
-
of
public static InstanceType of(JsonValue value)
Returns the type of the specified JSON value.- Parameters:
value- the JSON value whose type will be returned.- Returns:
- the type of the JSON value.
- Throws:
NullPointerException- if the specifiedvalueisnull.
-
-