Modifier and Type | Field | Description |
---|---|---|
JsPath |
JsPair.path |
the location of the element.
|
Modifier and Type | Method | Description |
---|---|---|
JsPath |
JsPath.append(JsPath path) |
Creates a new JsPath appending the given path to this path.
|
JsPath |
JsPath.dec() |
Returns a new path decrementing the last index by one, throwing an UnsupportedOperationException
if the last Position is not an index
|
static JsPath |
JsPath.empty() |
Returns the singleton empty path.
|
JsPath |
JsPath.inc() |
Returns a new path incrementing the last index by one, throwing an UnsupportedOperationException
if the last Position is not an index
|
JsPath |
JsPath.index(int i) |
Returns a new path appending an index with the given value to the back of this path.
|
JsPath |
JsPath.init() |
Returns a new path without the last Position of this path.
|
JsPath |
JsPath.key(String key) |
creates a new JsPath appending the key to
this JsPath. |
JsPath |
JsPath.mapKeys(UnaryOperator<String> map) |
Creates a new JsPath applying the given map function to every key of this path.
|
static JsPath |
JsPath.of(String path) |
|
JsPath |
JsPath.prepend(JsPath path) |
Creates a new JsPath prepending the given path to this path.
|
JsPath |
JsPath.tail() |
Modifier and Type | Method | Description |
---|---|---|
default T |
Json.append(JsPath path,
JsElem elem,
JsElem... others) |
Appends one or more elements, starting from the first, to the array located at the given path in
this json.
|
JsPath |
JsPath.append(JsPath path) |
Creates a new JsPath appending the given path to this path.
|
T |
Json.appendAll(JsPath path,
JsArray elems) |
Appends all the elements of the array, starting from the head, to the array located at the given
path in this json.
|
default T |
Json.appendAllIfPresent(JsPath path,
Function<? super JsArray,JsArray> function) |
Appends all the elements of the array computed by the function, starting from the head, to an
array located at the given path in this json, returning the same this instance if the array is
not present, in which case, the function is not invoked.
|
default T |
Json.appendIfPresent(JsPath path,
Supplier<JsElem> supplier) |
Appends one element given by a supplier, to the array located at the given path in this json,
returning the same this instance if the array is not present.
|
int |
JsPath.compareTo(JsPath that) |
Compares this path with another given as a parameter by comparing in order each of their positions,
one by one, until a result different than zero is returned or all the positions of any path are
consumed.
|
default boolean |
Json.containsPath(JsPath path) |
Returns true if an element exists in this json at the given path.
|
default JsElem |
Json.get(JsPath path) |
Returns the element located at the given path or
JsNothing if it doesn't exist. |
default Optional<JsArray> |
Json.getArray(JsPath path) |
Returns the array located at the given path or
Optional.empty() if it doesn't exist or
it's not an array. |
default Optional<BigDecimal> |
Json.getBigDecimal(JsPath path) |
Returns the big decimal located at the given path as a big decimal or
Optional.empty() if
it doesn't exist or it's not a decimal number. |
default Optional<BigInteger> |
Json.getBigInt(JsPath path) |
Returns the big integer located at the given path as a big integer or
Optional.empty() if it doesn't
exist or it's not an integral number. |
default Optional<Boolean> |
Json.getBool(JsPath path) |
Returns the boolean located at the given path or
Optional.empty() if it doesn't exist. |
default OptionalDouble |
Json.getDouble(JsPath path) |
Returns the decimal number located at the given path as a double or
OptionalDouble.empty() if it
doesn't exist or it's not a decimal number. |
default OptionalInt |
Json.getInt(JsPath path) |
Returns the integral number located at the given path as an integer or
OptionalInt.empty() if it
doesn't exist or it's not an integral number or it's an integral number but doesn't fit in an integer. |
default OptionalLong |
Json.getLong(JsPath path) |
Returns the integral number located at the given path as a long or
OptionalLong.empty() if it
doesn't exist or it's not an integral number or it's an integral number but doesn't fit in a long. |
default Optional<JsObj> |
Json.getObj(JsPath path) |
Returns the object located at the given path or
Optional.empty() if it doesn't exist or it's
not an object. |
default Optional<String> |
Json.getStr(JsPath path) |
Returns the string located at the given path or
Optional.empty() if it doesn't exist or it's
not an string. |
default T |
Json.merge(JsPath path,
JsElem value,
BiFunction<? super JsElem,? super JsElem,? extends JsElem> fn) |
If the given path is not already associated with a value or is associated with null, associates it with the given value.
|
static JsPair |
JsPair.of(JsPath path,
boolean b) |
Returns a json pair from the path and the boolean.
|
static JsPair |
JsPair.of(JsPath path,
double d) |
Returns a json pair from the path and the double.
|
static JsPair |
JsPair.of(JsPath path,
int i) |
Returns a json pair from the path and the integer.
|
static JsPair |
JsPair.of(JsPath path,
long l) |
Returns a json pair from the path and the long.
|
static JsPair |
JsPair.of(JsPath path,
String s) |
Returns a json pair from the path and the string.
|
static JsPair |
JsPair.of(JsPath path,
BigDecimal bd) |
Returns a json pair from the path and the big decimal.
|
static JsPair |
JsPair.of(JsPath path,
BigInteger bi) |
Returns a json pair from the path and the big integer.
|
static JsPair |
JsPair.of(JsPath path,
JsElem elem) |
Returns a json pair from the path and the json element.
|
default T |
Json.prepend(JsPath path,
JsElem elem,
JsElem... others) |
prepends one or more elements, starting from the first, to the array located at the path in this
json.
|
JsPath |
JsPath.prepend(JsPath path) |
Creates a new JsPath prepending the given path to this path.
|
T |
Json.prependAll(JsPath path,
JsArray elems) |
prepends all the elements of the array, starting from the head, to the array located at the path
in this json.
|
default T |
Json.prependAllIfPresent(JsPath path,
Function<? super JsArray,JsArray> function) |
Prepends all the elements of the array computed by the function, starting from the head, to the
array located at the path in this json, returning the same
this instance if the array is not present, in which case, the function is not invoked.
|
default T |
Json.prependIfPresent(JsPath path,
Supplier<JsElem> supplier) |
Prepends one element given by a supplier, to the array located at the given path in this json,
returning the same this instance if the array is not present.
|
T |
Json.put(JsPath path,
Function<? super JsElem,? extends JsElem> fn) |
Inserts the element returned by the function at the path in this json, replacing any existing element and filling with
JsNull empty indexes in arrays when necessary. |
default T |
Json.put(JsPath path,
JsElem element) |
Inserts the element at the path in this json, replacing any existing element and filling with
JsNull empty
indexes in arrays when necessary. |
default T |
Json.putIf(Predicate<? super JsElem> predicate,
JsPath path,
Function<? super JsElem,? extends JsElem> fn) |
Inserts at the given path in this json, if the existing element satisfies the predicate, a new
element returned by the function.
|
default T |
Json.putIfAbsent(JsPath path,
Supplier<? extends JsElem> supplier) |
Inserts at the given path in this json, if no element is present, the element returned by the
supplier, replacing any existing element in the path and filling with
JsNull
empty positions in arrays when necessary. |
default T |
Json.putIfPresent(JsPath path,
Function<? super JsElem,? extends JsElem> fn) |
Inserts at the given path in this json, if some element is present, the element returned by the
function.
|
T |
Json.remove(JsPath path) |
Removes the element in this json located at the given path, if it exists, returning the same this
instance otherwise
|
default OptionalInt |
Json.size(JsPath path) |
Returns the size of the json located at the given path in this json or OptionalInt.empty() if it
doesn't exist or it's not a Json
|
default OptionalInt |
Json.size_(JsPath path) |
Returns the size of the json located at the given path in this json or OptionalInt.empty() if it
doesn't exist or it's not a Json
|
Modifier and Type | Method | Description |
---|---|---|
T |
Json.filterObjs(BiPredicate<JsPath,JsObj> filter) |
Filters the pair of jsons in the first level parse this json, removing those that don't match
the predicate.
|
T |
Json.filterObjs_(BiPredicate<JsPath,JsObj> filter) |
Filters all the pair of jsons parse this json, removing those that don't match the predicate.
|
<T> T |
JsPath.ifPredicateElse(Predicate<? super JsPath> predicate,
Supplier<T> ifTrueFn,
Supplier<T> ifFalseFn) |
Provides a declarative way of implementing an if-else statement based on the condition given by
the predicate.
|
T |
Json.mapObjs(BiFunction<JsPath,JsObj,JsObj> fn) |
Maps the jsons in the first level parse this json.
|
T |
Json.mapObjs(BiFunction<JsPath,JsObj,JsObj> fn,
BiPredicate<JsPath,JsObj> predicate) |
Maps the jsons in the first level parse this json that satisfies a given predicate.
|
T |
Json.mapObjs(BiFunction<JsPath,JsObj,JsObj> fn,
BiPredicate<JsPath,JsObj> predicate) |
Maps the jsons in the first level parse this json that satisfies a given predicate.
|
T |
Json.mapObjs_(BiFunction<JsPath,JsObj,JsObj> fn) |
Maps all the jsons parse this json.
|
T |
Json.mapObjs_(BiFunction<JsPath,JsObj,JsObj> fn,
BiPredicate<JsPath,JsObj> predicate) |
Maps all the jsons parse this json that satisfies a given predicate.
|
T |
Json.mapObjs_(BiFunction<JsPath,JsObj,JsObj> fn,
BiPredicate<JsPath,JsObj> predicate) |
Maps all the jsons parse this json that satisfies a given predicate.
|
JsPair |
JsPair.mapPath(UnaryOperator<JsPath> map) |
Returns a new pair with the same element and a new path result of applying the mapping function
|
ParseOptions |
ParseOptions.withKeyFilter(Predicate<JsPath> keyFilter) |
adds a function to this builder to filter the keys of the json to be parsed.
|
Copyright © 2019. All rights reserved.