Module json_values
Package jsonvalues

Class JsBool

All Implemented Interfaces:
JsValue

public final class JsBool extends JsPrimitive
Represents an immutable JSON boolean. Only two instances are created: FALSE and TRUE
  • Field Details

    • FALSE

      public static final JsBool FALSE
      The singleton false value.
    • TRUE

      public static final JsBool TRUE
      The singleton true value.
    • prism

      public static final fun.optic.Prism<JsValue,Boolean> prism
      prism between the sum type JsValue and JsBool
    • value

      public final boolean value
      the boolean value.
  • Method Details

    • of

      public static JsBool of(boolean b)
      Static factory method to create a JsBool from a boolean primitive type.
      Parameters:
      b - the boolean value
      Returns:
      either TRUE or FALSE
    • toJsPrimitive

      public JsPrimitive toJsPrimitive()
    • isBool

      public boolean isBool()
      Description copied from interface: JsValue
      Returns true if this JsValue is a JsBool
      Returns:
      true if this JsValue is a JsBool
    • isTrue

      public boolean isTrue()
      Description copied from interface: JsValue
      Returns true if this JsValue is a JsBool, and it's true
      Returns:
      true if this JsValue is a JsBool, and it's true
    • isFalse

      public boolean isFalse()
      Description copied from interface: JsValue
      Returns true if this JsValue is a JsBool, and it's false
      Returns:
      true if this JsValue is a JsBool, and it's false
    • hashCode

      public int hashCode()
      Returns the hashcode of this JSON boolean.
      Overrides:
      hashCode in class Object
      Returns:
      1 if true, 0 if false
    • equals

      public boolean equals(Object that)
      Indicates whether some other object is "equal to" this JSON boolean.
      Overrides:
      equals in class Object
      Parameters:
      that - the reference object with which to compare.
      Returns:
      true if that is a JsBool with the same value as this JsBool
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      "true" or "false"