Package jsonvalues

Class JsPair


  • public final class JsPair
    extends java.lang.Object
    Immutable pair which represents a value and its location: (path, value).
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object that)
      Returns true if that is a pair and both represents the same element at the same location.
      int hashCode()
      Returns the hashcode of this pair.
      static JsPair of​(java.lang.String key, boolean b)
      Returns a json pair from the key and the boolean.
      static JsPair of​(java.lang.String key, double d)
      Returns a json pair from the key and the double.
      static JsPair of​(java.lang.String key, int i)
      Returns a json pair from the key and the integer.
      static JsPair of​(java.lang.String key, long l)
      Returns a json pair from the key and the long.
      static JsPair of​(java.lang.String key, java.lang.String s)
      Returns a json pair from the key and the string.
      static JsPair of​(java.lang.String key, java.math.BigDecimal bd)
      Returns a json pair from the key and the big decimal.
      static JsPair of​(java.lang.String key, java.math.BigInteger bi)
      Returns a json pair from the key and the big integer.
      static JsPair of​(JsPath path, boolean b)
      Returns a json pair from the path and the boolean.
      static JsPair of​(JsPath path, double d)
      Returns a json pair from the path and the double.
      static JsPair of​(JsPath path, int i)
      Returns a json pair from the path and the integer.
      static JsPair of​(JsPath path, long l)
      Returns a json pair from the path and the long.
      static JsPair of​(JsPath path, java.lang.String s)
      Returns a json pair from the path and the string.
      static JsPair of​(JsPath path, java.math.BigDecimal bd)
      Returns a json pair from the path and the big decimal.
      static JsPair of​(JsPath path, java.math.BigInteger bi)
      Returns a json pair from the path and the big integer.
      static JsPair of​(JsPath path, JsValue elem)
      Returns a json pair from the path and the json element.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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 JsValue
        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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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,
                                java.lang.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​(java.lang.String key,
                                java.lang.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,
                                java.math.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​(java.lang.String key,
                                java.math.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,
                                java.math.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​(java.lang.String key,
                                java.math.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 java.lang.Object
        Returns:
        the hashcode of this pair
      • equals

        public boolean equals​(java.lang.Object that)
        Returns true if that is a pair and both represents the same element at the same location.
        Overrides:
        equals in class java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        string representation of this pair: (path, elem)