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 Details

    • getValue

      T getValue()
      Return the value
      Returns:
      the value
    • toString

      String toString()
      Overrides:
      toString in class Object
    • 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 a JSONObject instance
      Returns:
      true if the value is a JSONObject
    • setValue

      void setValue​(T value)
      Set the value
      Parameters:
      value - the value
    • prettyPrint

      String prettyPrint()
      Returns a pretty-printed JSON structure
      Returns:
      a pretty-printed JSON structure
    • prettyPrint

      String prettyPrint​(int indent)
      Pretty print using a specified indent value
      Parameters:
      indent - the indent value
      Returns:
      a pretty-printed JSON structure
    • isEquivalent

      boolean isEquivalent​(JSONValue<?> otherValue)