Class JsonElement


  • @ProviderType
    public final class JsonElement
    extends Object
    A simple bean representing a JSON stream element.
    • Field Detail

      • DEFAULT_START_OBJECT

        public static final JsonElement DEFAULT_START_OBJECT
        The default JSON object start element
      • DEFAULT_START_ARRAY

        public static final JsonElement DEFAULT_START_ARRAY
        The default JSON array start element
      • DEFAULT_END_OBJECT

        public static final JsonElement DEFAULT_END_OBJECT
        The default JSON object end element
      • DEFAULT_END_ARRAY

        public static final JsonElement DEFAULT_END_ARRAY
        The default JSON array end element
    • Constructor Detail

      • JsonElement

        public JsonElement​(String key,
                           Object value,
                           JsonElementType type)
        Parameters:
        key - JSON element name
        value - JSON element value
        type - JSON element type
    • Method Detail

      • nullValue

        public static JsonElement nullValue​(String key)
        Creator for JSON value element with value being NULL.
        Parameters:
        key - JSON element name
        Returns:
        JSON value element with value NULL
      • value

        public static JsonElement value​(Object value)
        Creator for JSON value element with given value and no key.
        Parameters:
        value - JSON element value
        Returns:
        JSON value element
      • value

        public static JsonElement value​(String key,
                                        Object value)
        Creator for JSON value element with given key and value
        Parameters:
        key - JSON element name
        value - JSON element value
        Returns:
        JSON value element
      • startObject

        public static JsonElement startObject​(String key)
        Creator for JSON object start element with given key
        Parameters:
        key - JSON element name
        Returns:
        JSON object start element
      • startArray

        public static JsonElement startArray​(String key)
        Creator for JSON array start element with given key
        Parameters:
        key - JSON element name
        Returns:
        JSON array start element
      • getKey

        public String getKey()
        Returns:
        the key
      • getValue

        public Object getValue()
        Returns:
        the value
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isStartingElement

        public boolean isStartingElement()
        Returns:
        True if is a starting element
      • isClosingElement

        public boolean isClosingElement()
        Returns:
        True if is a closing element