Package jsonvalues

Class JsInt

    • Field Detail

      • prism

        public static final Prism<JsValue,​Integer> prism
        prism between the sum type JsValue and JsInt
      • value

        public final int value
        The integer value.
    • Method Detail

      • id

        public int id()
        Specified by:
        id in interface JsValue
      • isInt

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

        public int hashCode()
        Returns the hashcode of this json integer.
        Overrides:
        hashCode in class Object
        Returns:
        hashcode of this JsInt
      • equals

        public boolean equals​(Object that)
        Indicates whether some other object is "equal to" this json integer. Numbers of different types are equals if the have the same value.
        Overrides:
        equals in class Object
        Parameters:
        that - the reference object with which to compare.
        Returns:
        true if that is a JsNumber with the same value as this JsInt.
      • map

        public JsInt map​(IntUnaryOperator fn)
        Maps this json integer into another one.
        Parameters:
        fn - the mapping function
        Returns:
        a new JsInt
      • of

        public static JsInt of​(int n)
        Static factory method to create a JsInt from an integer primitive type.
        Parameters:
        n - the integer primitive type
        Returns:
        a new JsInt
      • test

        public boolean test​(IntPredicate predicate)
        /** Tests the value of this json integer on a predicate.
        Parameters:
        predicate - the predicate
        Returns:
        true if this integer satisfies the predicate