Package org.ghotibeaun.json
Interface JSONValue<T>
- Type Parameters:
T- the value type
- All Superinterfaces:
Comparable<JSONValue<T>>,Serializable
public interface JSONValue<T> extends Serializable, Comparable<JSONValue<T>>
Interface for values stored in JSONObject or JSONArray containers
- Author:
- jearley
-
Method Summary
Modifier and Type Method Description JSONValueTypegetType()Returns the value type hintTgetValue()Return the valuebooleanisArray()Returns whether the value is a JSONArray instancebooleanisEquivalent(JSONValue<?> otherValue)default booleanisObject()Returns whether the value is aJSONObjectinstancebooleanisPrimitive()Returns whether the value is a primitive data type (String, Number, Boolean, Null)StringprettyPrint()Returns a pretty-printed JSON structureStringprettyPrint(int indent)Pretty print using a specified indent valuevoidsetValue(T value)Set the valueStringtoString()Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
getValue
T getValue()Return the value- Returns:
- the value
-
toString
String toString() -
getType
JSONValueType getType()Returns the value type hint- Returns:
- the value type hint
-
isPrimitive
boolean isPrimitive()Returns whether the value is a primitive data type (String, Number, Boolean, Null)- Returns:
- true if the value is a primitive data type
-
isArray
boolean isArray()Returns whether the value is a JSONArray instance- Returns:
- true if the value is a JSONArray
-
isObject
default boolean isObject()Returns whether the value is aJSONObjectinstance- Returns:
- true if the value is a JSONObject
-
setValue
Set the value- Parameters:
value- the value
-
prettyPrint
String prettyPrint()Returns a pretty-printed JSON structure- Returns:
- a pretty-printed JSON structure
-
prettyPrint
Pretty print using a specified indent value- Parameters:
indent- the indent value- Returns:
- a pretty-printed JSON structure
-
isEquivalent
-