Package jsonvalues

Class JsPair


  • public final class JsPair
    extends Object
    Immutable pair which represents a value and its location: (path, value).
    • Field Detail

      • pathLens

        public static final Lens<JsPair,​JsPath> pathLens
        lens that focuses on the path of a pair
      • valueLens

        public static final Lens<JsPair,​JsValue> valueLens
        lens that focuses on the value of a pair
      • value

        public final JsValue value
        the json value.
      • path

        public final JsPath path
        the location of the value.
    • Method Detail

      • of

        public static JsPair of​(JsPath path,
                                JsValue elem)
        Returns a json pair from the path and the json element.
        Parameters:
        path - the JsPath object
        elem - the JsElem
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(JsPath path,
                                int i)
        Returns a json pair from the path and the integer.
        Parameters:
        path - the JsPath
        i - the integer
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(String key,
                                int i)
        Returns a json pair from the key and the integer.
        Parameters:
        key - the key
        i - the integer
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(JsPath path,
                                double d)
        Returns a json pair from the path and the double.
        Parameters:
        path - the JsPath
        d - the double
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(String key,
                                double d)
        Returns a json pair from the key and the double.
        Parameters:
        key - the key
        d - the double
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(JsPath path,
                                long l)
        Returns a json pair from the path and the long.
        Parameters:
        path - the JsPath
        l - the long
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(String key,
                                long l)
        Returns a json pair from the key and the long.
        Parameters:
        key - the key
        l - the long
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(JsPath path,
                                boolean b)
        Returns a json pair from the path and the boolean.
        Parameters:
        path - the JsPath
        b - the boolean
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(String key,
                                boolean b)
        Returns a json pair from the key and the boolean.
        Parameters:
        key - the key
        b - the boolean
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(JsPath path,
                                String s)
        Returns a json pair from the path and the string.
        Parameters:
        path - the JsPath
        s - the string
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(String key,
                                String s)
        Returns a json pair from the key and the string.
        Parameters:
        key - the JsPath
        s - the string
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(JsPath path,
                                BigDecimal bd)
        Returns a json pair from the path and the big decimal.
        Parameters:
        path - the JsPath
        bd - the big decimal
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(String key,
                                BigDecimal bd)
        Returns a json pair from the key and the big decimal.
        Parameters:
        key - the key
        bd - the big decimal
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(JsPath path,
                                BigInteger bi)
        Returns a json pair from the path and the big integer.
        Parameters:
        path - the JsPath
        bi - the big integer
        Returns:
        an immutable JsPair
      • of

        public static JsPair of​(String key,
                                BigInteger bi)
        Returns a json pair from the key and the big integer.
        Parameters:
        key - the key
        bi - the big integer
        Returns:
        an immutable JsPair
      • hashCode

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

        public boolean equals​(Object that)
        Returns true if that is a pair and both represents the same element at the same location.
        Overrides:
        equals in class Object
        Parameters:
        that - the reference object with which to compare.
        Returns:
        true if this.element.equals(that.element) and this.path.equals(that.path)
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        string representation of this pair: (path, elem)