Package jsonvalues

Class JsNothing

java.lang.Object
jsonvalues.JsNothing
All Implemented Interfaces:
JsValue

public final class JsNothing extends Object implements JsValue
It's a special JSON element that represents 'nothing'. Inserting nothing in a JSON leaves the json unchanged. The functions that return a JsValue, like Json.get(JsPath), return nothing when no element is found, what makes them total on the input path.
  • Field Details

    • NOTHING

      public static final JsNothing NOTHING
      The singleton nothing value.
  • Method Details

    • toJsPrimitive

      public JsPrimitive toJsPrimitive()
      Description copied from interface: JsValue
      Returns this JsValue as a JsPrimitive.
      Specified by:
      toJsPrimitive in interface JsValue
      Returns:
      This JsValue as a JsPrimitive.
    • isNothing

      public boolean isNothing()
      Description copied from interface: JsValue
      Returns true if this element is JsNothing.
      Specified by:
      isNothing in interface JsValue
      Returns:
      True if this element is JsNothing.
    • hashCode

      public int hashCode()
      Returns the hashcode of this JsNothing.
      Overrides:
      hashCode in class Object
      Returns:
      1
    • equals

      public boolean equals(Object that)
      Returns true if that is the singleton NOTHING.
      Overrides:
      equals in class Object
      Parameters:
      that - the reference object with which to compare.
      Returns:
      true if that is NOTHING
    • toString

      public String toString()
      Overrides:
      toString in class Object