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 Detail

      • FALSE

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

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

        public static final Prism<JsValue,​java.lang.Boolean> prism
        prism between the sum type JsValue and JsBool
      • value

        public final boolean value
        the boolean value.
    • Method Detail

      • 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
      • id

        public int id()
      • isBool

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

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

        public boolean isFalse()
        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 java.lang.Object
        Returns:
        1 if true, 0 if false
      • equals

        public boolean equals​(java.lang.Object that)
        Indicates whether some other object is "equal to" this json boolean.
        Overrides:
        equals in class java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        "true" or "false"