Package jsonvalues

Class JsBool

  • All Implemented Interfaces:
    JsElem

    public final class JsBool
    extends Object
    implements JsElem
    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.
      • x

        public final boolean x
        the boolean value.
    • Method Detail

      • equals

        public boolean equals​(@Nullable 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
      • hashCode

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

        public JsBool negate()
        Negates this json boolean (implementation of ! operator).
        Returns:
        the inverse value of this
      • 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
      • toString

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

        public boolean isObj()
        Specified by:
        isObj in interface JsElem
        Returns:
        true if this JsElem is a JsObj
      • isArray

        public boolean isArray()
        Specified by:
        isArray in interface JsElem
        Returns:
        true if this JsElem is a JsArray
      • isNothing

        public boolean isNothing()
        Specified by:
        isNothing in interface JsElem
        Returns:
        true if this element is JsNothing
      • isNull

        public boolean isNull()
        Specified by:
        isNull in interface JsElem
        Returns:
        true if this element is null
      • isNumber

        public boolean isNumber()
        Specified by:
        isNumber in interface JsElem
        Returns:
        true if this element is a number
      • isBool

        public boolean isBool()
        Specified by:
        isBool in interface JsElem
        Returns:
        true if this JsElem is a JsBool
      • isTrue

        public boolean isTrue()
        Specified by:
        isTrue in interface JsElem
        Returns:
        true if this JsElem is a JsBool and it's true
      • isFalse

        public boolean isFalse()
        Specified by:
        isFalse in interface JsElem
        Returns:
        true if this JsElem is a JsBool and it's false
      • isInt

        public boolean isInt()
        Specified by:
        isInt in interface JsElem
        Returns:
        true if this JsElem is a JsInt
      • isDouble

        public boolean isDouble()
        Specified by:
        isDouble in interface JsElem
        Returns:
        true if this JsElem is a JsDouble
      • isBigDec

        public boolean isBigDec()
        Specified by:
        isBigDec in interface JsElem
        Returns:
        true if this JsElem is a JsBigDec
      • isLong

        public boolean isLong()
        Specified by:
        isLong in interface JsElem
        Returns:
        true if this JsElem is a JsLong
      • isStr

        public boolean isStr()
        Specified by:
        isStr in interface JsElem
        Returns:
        true if this JsElem is a JsStr
      • isBigInt

        public boolean isBigInt()
        Specified by:
        isBigInt in interface JsElem
        Returns:
        true if this JsElem is a JsBigInt