Package jsonvalues
Class JsPair
- java.lang.Object
-
- jsonvalues.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()
-
-
-
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 objectelem
- 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 JsPathi
- 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 keyi
- 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 JsPathd
- 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 keyd
- 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 JsPathl
- 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 keyl
- 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 JsPathb
- 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 keyb
- 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 JsPaths
- 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 JsPaths
- 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 JsPathbd
- 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 keybd
- 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 JsPathbi
- 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 keybi
- the big integer- Returns:
- an immutable JsPair
-
hashCode
public int hashCode()
Returns the hashcode of this pair.- Overrides:
hashCode
in classjava.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 classjava.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 classjava.lang.Object
- Returns:
- string representation of this pair: (path, elem)
-
-