public class JsObj extends Object implements Json<JsObj>, Iterable<io.vavr.Tuple2<String,JsValue>>
Modifier and Type | Field and Description |
---|---|
static JsObj |
EMPTY |
static JsOptics.JsObjLenses |
lens
lenses defined for a Json object
|
static JsOptics.JsObjOptional |
optional
optionals defined for a Json object
|
static fun.optic.Prism<JsValue,JsObj> |
prism
prism between the sum type JsValue and JsObj
|
static int |
TYPE_ID |
Constructor and Description |
---|
JsObj() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
return true if the key is present
|
boolean |
containsValue(JsValue el)
Returns true if this json contains the given element in the first level.
|
JsObj |
delete(JsPath path)
Removes the element in this json located at the given path, if it exists, returning the same this
instance otherwise
|
JsObj |
delete(String key) |
static JsObj |
empty() |
boolean |
equals(JsObj that,
JsArray.TYPE ARRAY_AS)
return true if this obj is equal to the given as a parameter.
|
boolean |
equals(Object that) |
JsObj |
filterAllKeys(BiPredicate<? super JsPath,? super JsValue> filter)
Filters all the keys of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterAllKeys(Predicate<? super String> filter)
Filters all the keys of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterAllObjs(BiPredicate<? super JsPath,? super JsObj> filter)
Filters all the pair of jsons of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterAllObjs(Predicate<? super JsObj> filter)
Filters all the pair of jsons of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterAllValues(BiPredicate<? super JsPath,? super JsPrimitive> filter)
Filters all the pairs of elements of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterAllValues(Predicate<? super JsPrimitive> filter)
Filters all the pairs of elements of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterKeys(BiPredicate<? super String,? super JsValue> filter) |
JsObj |
filterKeys(Predicate<? super String> filter)
Filters the keys in the first level of this json, removing those that don't ifPredicateElse the predicate.
|
JsObj |
filterObjs(BiPredicate<? super String,? super JsObj> filter) |
JsObj |
filterObjs(Predicate<? super JsObj> filter)
Filters the pair of jsons in the first level of this json, removing those that don't ifPredicateElse
the predicate.
|
JsObj |
filterValues(BiPredicate<? super String,? super JsPrimitive> filter) |
JsObj |
filterValues(Predicate<? super JsPrimitive> filter)
Filters the pairs of elements in the first level of this json, removing those that don't ifPredicateElse
the predicate.
|
JsValue |
get(JsPath path)
Returns the element located at the given path or
JsNothing if it doesn't exist. |
JsValue |
get(String key) |
JsArray |
getArray(String key)
Returns the array located at the given key or null if it doesn't exist or it's not an array.
|
JsArray |
getArray(String key,
Supplier<JsArray> orElse)
Returns the array located at the given key or the default value provided if it
doesn't exist or it's not an array.
|
BigDecimal |
getBigDec(String key)
Returns the number located at the given key as a big decimal or null if it doesn't exist or it's
not a decimal number.
|
BigDecimal |
getBigDec(String key,
Supplier<BigDecimal> orElse)
Returns the number located at the given key as a big decimal or the default value provided
if it doesn't exist or it's not a decimal number.
|
BigInteger |
getBigInt(String key)
Returns the big integer located at the given key as a big integer or null if it doesn't
exist or it's not an integral number.
|
BigInteger |
getBigInt(String key,
Supplier<BigInteger> orElse)
Returns the big integer located at the given key as a big integer or the default value provided
if it doesn't exist or it's not an integral number.
|
byte[] |
getBinary(String key)
Returns the bytes located at the given key or null if it doesn't exist or it's
not an array of bytes.
|
byte[] |
getBinary(String key,
Supplier<byte[]> orElse)
Returns the bytes located at the given key or the default value provided if it doesn't exist
or it's not an array of bytes.
|
Boolean |
getBool(String key)
Returns the boolean located at the given key or null if it doesn't exist.
|
Boolean |
getBool(String key,
Supplier<Boolean> orElse)
Returns the boolean located at the given key or the default value provided if it doesn't exist.
|
Double |
getDouble(String key)
Returns the number located at the given key as a double or null if it
doesn't exist or it's not a decimal number.
|
Double |
getDouble(String key,
Supplier<Double> orElse)
Returns the number located at the given key as a double or the default value provided if it
doesn't exist or it's not a decimal number.
|
Instant |
getInstant(String key)
Returns the instant located at the given key or null if it doesn't exist or it's
not an instant.
|
Instant |
getInstant(String key,
Supplier<Instant> orElse)
Returns the instant located at the given key or the default value provided if it doesn't
exist or it's not an instant.
|
Integer |
getInt(String key)
Returns the integral number located at the given key as an integer or null 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.
|
Integer |
getInt(String key,
Supplier<Integer> orElse)
Returns the integral number located at the given key as an integer or the default value provided 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.
|
Long |
getLong(String key)
Returns the integral number located at the given key as a long or null 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.
|
Long |
getLong(String key,
Supplier<Long> orElse)
Returns the integral number located at the given key as a long or the default value provided
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.
|
JsObj |
getObj(String key)
Returns the json object located at the given key or null if it doesn't exist or it's not an object.
|
JsObj |
getObj(String key,
Supplier<JsObj> orElse)
Returns the json object located at the given key or the default value provided
if it doesn't exist or it's not an object.
|
String |
getStr(String key)
Returns the string located at the given key or null if it doesn't exist or it's not an string.
|
String |
getStr(String key,
Supplier<String> orElse)
Returns the string located at the given key or the default value provided if it doesn't
exist or it's not an string.
|
int |
hashCode()
equals method is inherited, so it's implemented.
|
int |
id() |
JsObj |
intersection(JsObj that,
JsArray.TYPE ARRAY_AS)
this.intersection(that, SET) returns an array with the elements that exist in both this and that
this.intersection(that, MULTISET) returns an array with the elements that exist in both this and that ,
being duplicates allowed. |
JsObj |
intersectionAll(JsObj that,
JsArray.TYPE ARRAY_AS)
this.intersectionAll(that) behaves as this.intersection(that, LIST) , but for those elements
that are containers of the same type and are located at the same position, the result is their
intersection. |
boolean |
isEmpty()
return true if there's no element in this json
|
boolean |
isObj()
Returns true if this JsValue is a JsObj
|
Iterator<io.vavr.Tuple2<String,JsValue>> |
iterator() |
Set<String> |
keySet()
Returns a set containing each key fo this object.
|
JsObj |
mapAllKeys(BiFunction<? super JsPath,? super JsValue,String> fn)
Maps all the keys of this json.
|
JsObj |
mapAllKeys(Function<? super String,String> fn)
Maps all the keys of this json.
|
JsObj |
mapAllObjs(BiFunction<? super JsPath,? super JsObj,? extends JsValue> fn)
Maps all the jsons of this json.
|
JsObj |
mapAllObjs(Function<? super JsObj,? extends JsValue> fn)
Maps all the jsons of this json.
|
JsObj |
mapAllValues(BiFunction<? super JsPath,? super JsPrimitive,? extends JsValue> fn)
Maps all the values of this json.
|
JsObj |
mapAllValues(Function<? super JsPrimitive,? extends JsValue> fn)
Maps all the values of this json.
|
JsObj |
mapKeys(BiFunction<? super String,? super JsValue,String> fn) |
JsObj |
mapKeys(Function<? super String,String> fn)
Maps the keys in the first level of this json.
|
JsObj |
mapObjs(BiFunction<? super String,? super JsObj,JsValue> fn) |
JsObj |
mapObjs(Function<? super JsObj,? extends JsValue> fn)
Maps the jsons in the first level of this json.
|
JsObj |
mapValues(BiFunction<? super String,? super JsPrimitive,? extends JsValue> fn) |
JsObj |
mapValues(Function<? super JsPrimitive,? extends JsValue> fn)
Maps the values in the first level of this json.
|
static JsObj |
of(JsPath path,
JsValue el) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16,
JsPath path17,
JsValue el17) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16,
JsPath path17,
JsValue el17,
JsPath path18,
JsValue el18) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16,
JsPath path17,
JsValue el17,
JsPath path18,
JsValue el18,
JsPath path19,
JsValue el19) |
static JsObj |
of(JsPath path1,
JsValue el1,
JsPath path2,
JsValue el2,
JsPath path3,
JsValue el3,
JsPath path4,
JsValue el4,
JsPath path5,
JsValue el5,
JsPath path6,
JsValue el6,
JsPath path7,
JsValue el7,
JsPath path8,
JsValue el8,
JsPath path9,
JsValue el9,
JsPath path10,
JsValue el10,
JsPath path11,
JsValue el11,
JsPath path12,
JsValue el12,
JsPath path13,
JsValue el13,
JsPath path14,
JsValue el14,
JsPath path15,
JsValue el15,
JsPath path16,
JsValue el16,
JsPath path17,
JsValue el17,
JsPath path18,
JsValue el18,
JsPath path19,
JsValue el19,
JsPath path20,
JsValue el20) |
static JsObj |
of(String key,
JsValue el) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19) |
static JsObj |
of(String key1,
JsValue el1,
String key2,
JsValue el2,
String key3,
JsValue el3,
String key4,
JsValue el4,
String key5,
JsValue el5,
String key6,
JsValue el6,
String key7,
JsValue el7,
String key8,
JsValue el8,
String key9,
JsValue el9,
String key10,
JsValue el10,
String key11,
JsValue el11,
String key12,
JsValue el12,
String key13,
JsValue el13,
String key14,
JsValue el14,
String key15,
JsValue el15,
String key16,
JsValue el16,
String key17,
JsValue el17,
String key18,
JsValue el18,
String key19,
JsValue el19,
String key20,
JsValue el20) |
static JsObj |
parse(String str)
Tries to parse the string into an immutable object.
|
static JsObj |
parseYaml(String str)
Tries to parse a YAML string into an immutable object.
|
<R> Optional<R> |
reduce(BinaryOperator<R> op,
BiFunction<? super String,? super JsPrimitive,R> map,
BiPredicate<? super String,? super JsPrimitive> predicate)
Performs a reduction on the values that satisfy the predicate in the first level of this json.
|
<R> Optional<R> |
reduce(BinaryOperator<R> op,
Function<? super JsPrimitive,R> map,
Predicate<? super JsPrimitive> predicate)
Performs a reduction on the values that satisfy the predicate in the first level of this json.
|
<R> Optional<R> |
reduceAll(BinaryOperator<R> op,
BiFunction<? super JsPath,? super JsPrimitive,R> map,
BiPredicate<? super JsPath,? super JsPrimitive> predicate)
Performs a reduction on the values of this json that satisfy the predicate.
|
<R> Optional<R> |
reduceAll(BinaryOperator<R> op,
Function<? super JsPrimitive,R> map,
Predicate<? super JsPrimitive> predicate)
Performs a reduction on the values of this json that satisfy the predicate.
|
JsObj |
set(JsPath path,
JsValue element)
Inserts the element at the path in this json, replacing any existing element and filling with
JsNull empty indexes in arrays when necessary. |
JsObj |
set(JsPath path,
JsValue value,
JsValue padElement)
Inserts the element at the path in this json, replacing any existing element and filling with padElement
empty indexes in arrays when necessary.
|
JsObj |
set(String key,
JsValue value)
Inserts the element at the key in this json, replacing any existing element.
|
int |
size()
Returns the number of elements in the first level of this json
|
Stream<fun.tuple.Pair<JsPath,JsValue>> |
stream()
Returns a stream over the pairs of elements in the first level of this json object.
|
Stream<fun.tuple.Pair<JsPath,JsValue>> |
streamAll()
Returns a stream over all the pairs of elements in this json object.
|
Stream<JsValue> |
streamValues() |
String |
toString()
// Single-check idiom Item 83 from effective java
|
JsObj |
union(JsObj that)
returns
this json object plus those pairs from the given json object that which
keys don't exist in this . |
JsObj |
unionAll(JsObj that,
JsArray.TYPE ARRAY_AS)
behaves like the
union(JsObj) but, for those keys that exit in both this
and that json objects,
which associated elements are **containers of the same type**, the result is their union. |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
containsPath, equals, getArray, getArray, getBigDec, getBigDec, getBigInt, getBigInt, getBinary, getBinary, getBool, getBool, getDouble, getDouble, getInstant, getInstant, getInt, getInt, getLong, getLong, getObj, getObj, getStr, getStr, ifEmptyElse, isNotEmpty, serialize, serialize, sizeAll, times, timesAll, toJsPrimitive, toPrettyString, toPrettyString
ifNothing, ifNull, isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBinary, isBool, isDecimal, isDouble, isDouble, isFalse, isInstant, isInstant, isInt, isInt, isIntegral, isJson, isJson, isLong, isLong, isNothing, isNotNothing, isNotNull, isNotNumber, isNull, isNumber, isObj, isPrimitive, isSameType, isStr, isStr, isTrue, toJsArray, toJsBigDec, toJsBigInt, toJsBinary, toJsBool, toJsDouble, toJsInstant, toJsInt, toJsLong, toJsNumber, toJsObj, toJson, toJsStr
forEach, spliterator
public static final JsObj EMPTY
public static final JsOptics.JsObjLenses lens
public static final JsOptics.JsObjOptional optional
public static final fun.optic.Prism<JsValue,JsObj> prism
public static final int TYPE_ID
public static JsObj empty()
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16, JsPath path17, JsValue el17)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16, JsPath path17, JsValue el17, JsPath path18, JsValue el18)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16, JsPath path17, JsValue el17, JsPath path18, JsValue el18, JsPath path19, JsValue el19)
public static JsObj of(String key1, JsValue el1, String key2, JsValue el2, String key3, JsValue el3, String key4, JsValue el4, String key5, JsValue el5, String key6, JsValue el6, String key7, JsValue el7, String key8, JsValue el8, String key9, JsValue el9, String key10, JsValue el10, String key11, JsValue el11, String key12, JsValue el12, String key13, JsValue el13, String key14, JsValue el14, String key15, JsValue el15, String key16, JsValue el16, String key17, JsValue el17, String key18, JsValue el18, String key19, JsValue el19, String key20, JsValue el20)
public static JsObj of(JsPath path1, JsValue el1, JsPath path2, JsValue el2, JsPath path3, JsValue el3, JsPath path4, JsValue el4, JsPath path5, JsValue el5, JsPath path6, JsValue el6, JsPath path7, JsValue el7, JsPath path8, JsValue el8, JsPath path9, JsValue el9, JsPath path10, JsValue el10, JsPath path11, JsValue el11, JsPath path12, JsValue el12, JsPath path13, JsValue el13, JsPath path14, JsValue el14, JsPath path15, JsValue el15, JsPath path16, JsValue el16, JsPath path17, JsValue el17, JsPath path18, JsValue el18, JsPath path19, JsValue el19, JsPath path20, JsValue el20)
public static JsObj parse(String str)
str
- the string to be parsedMalformedJson
- if the string doesn't represent a json objectpublic static JsObj parseYaml(String str)
str
- the YAML to be parsedMalformedJson
- if the string doesn't represent a json objectpublic JsObj set(String key, JsValue value)
key
- the keyvalue
- the elementpublic boolean containsValue(JsValue el)
Json
containsValue
in interface Json<JsObj>
el
- the give element JsValue whose presence in this JsArray is to be testedpublic Set<String> keySet()
public JsValue get(JsPath path)
Json
JsNothing
if it doesn't exist.public JsObj filterValues(Predicate<? super JsPrimitive> filter)
Json
filterValues
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair in the first level of this jsonhow to filter the pair of elements of the whole json and not only the first level
public JsObj filterAllValues(BiPredicate<? super JsPath,? super JsPrimitive> filter)
Json
filterAllValues
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic JsObj filterAllValues(Predicate<? super JsPrimitive> filter)
Json
filterAllValues
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic JsObj filterKeys(Predicate<? super String> filter)
Json
filterKeys
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair in the first level of this jsonhow to filter the keys of the whole json and not only the first level
public JsObj filterAllKeys(BiPredicate<? super JsPath,? super JsValue> filter)
Json
filterAllKeys
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic JsObj filterAllKeys(Predicate<? super String> filter)
Json
filterAllKeys
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic JsObj filterObjs(Predicate<? super JsObj> filter)
Json
filterObjs
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair in the first level of this jsonpublic JsObj filterAllObjs(BiPredicate<? super JsPath,? super JsObj> filter)
Json
filterAllObjs
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic JsObj filterAllObjs(Predicate<? super JsObj> filter)
Json
filterAllObjs
in interface Json<JsObj>
filter
- the predicate which takes as the input every JsPair of this jsonpublic boolean isEmpty()
Json
public JsObj mapValues(Function<? super JsPrimitive,? extends JsValue> fn)
Json
public JsObj mapAllValues(BiFunction<? super JsPath,? super JsPrimitive,? extends JsValue> fn)
Json
mapAllValues
in interface Json<JsObj>
fn
- the mapping functionpublic JsObj mapAllValues(Function<? super JsPrimitive,? extends JsValue> fn)
Json
mapAllValues
in interface Json<JsObj>
fn
- the mapping functionpublic JsObj mapKeys(Function<? super String,String> fn)
Json
public JsObj mapAllKeys(BiFunction<? super JsPath,? super JsValue,String> fn)
Json
mapAllKeys
in interface Json<JsObj>
fn
- the mapping functionpublic JsObj mapAllKeys(Function<? super String,String> fn)
Json
mapAllKeys
in interface Json<JsObj>
fn
- the mapping functionpublic JsObj mapObjs(Function<? super JsObj,? extends JsValue> fn)
Json
public JsObj mapAllObjs(BiFunction<? super JsPath,? super JsObj,? extends JsValue> fn)
Json
mapAllObjs
in interface Json<JsObj>
fn
- the mapping functionpublic JsObj mapAllObjs(Function<? super JsObj,? extends JsValue> fn)
Json
mapAllObjs
in interface Json<JsObj>
fn
- the mapping functionpublic JsObj set(JsPath path, JsValue value, JsValue padElement)
Json
The same instance is returned when the head of the path is a key and this is an array or the head
of the path is an index and this is an object or the element is JsNothing
set
in interface Json<JsObj>
path
- the JsPath object where the element will be inserted atvalue
- the JsValue that will be insertedpadElement
- the JsValue that will be inserted in arrays when padding is necessarypublic JsObj set(JsPath path, JsValue element)
Json
JsNull
empty indexes in arrays when necessary.
The same instance is returned when the head of the path is a key and this is an array or the head
of the path is an index and this is an object or the element is JsNothing
public <R> Optional<R> reduce(BinaryOperator<R> op, Function<? super JsPrimitive,R> map, Predicate<? super JsPrimitive> predicate)
Json
reduce
in interface Json<JsObj>
R
- the type of the operands of the operatorop
- the operator upon two objects of type Rmap
- the mapping function which produces an object of type R from a JsValuepredicate
- the predicate that determines what JsValue will be mapped and reducedOptional
describing the of of the reductionto apply the reduction in all the Json and not only in the first level
public <R> Optional<R> reduceAll(BinaryOperator<R> op, BiFunction<? super JsPath,? super JsPrimitive,R> map, BiPredicate<? super JsPath,? super JsPrimitive> predicate)
Json
reduceAll
in interface Json<JsObj>
R
- the type of the operands of the operatorop
- the operator upon two objects of type Rmap
- the mapping function which produces an object of type R from a JsValuepredicate
- the predicate that determines what JsValue will be mapped and reducedOptional
describing the result of the reductionpublic <R> Optional<R> reduceAll(BinaryOperator<R> op, Function<? super JsPrimitive,R> map, Predicate<? super JsPrimitive> predicate)
Json
reduceAll
in interface Json<JsObj>
R
- the type of the operands of the operatorop
- the operator upon two objects of type Rmap
- the mapping function which produces an object of type R from a JsValuepredicate
- the predicate that determines what JsValue will be mapped and reducedOptional
describing the result of the reductionpublic JsObj delete(JsPath path)
Json
public int size()
Json
public Stream<fun.tuple.Pair<JsPath,JsValue>> streamAll()
Json
public Stream<JsValue> streamValues()
streamValues
in interface Json<JsObj>
public Stream<fun.tuple.Pair<JsPath,JsValue>> stream()
Json
public JsObj filterValues(BiPredicate<? super String,? super JsPrimitive> filter)
public JsObj filterKeys(BiPredicate<? super String,? super JsValue> filter)
public JsObj filterObjs(BiPredicate<? super String,? super JsObj> filter)
public JsObj mapValues(BiFunction<? super String,? super JsPrimitive,? extends JsValue> fn)
public JsObj mapKeys(BiFunction<? super String,? super JsValue,String> fn)
public JsObj mapObjs(BiFunction<? super String,? super JsObj,JsValue> fn)
public <R> Optional<R> reduce(BinaryOperator<R> op, BiFunction<? super String,? super JsPrimitive,R> map, BiPredicate<? super String,? super JsPrimitive> predicate)
R
- the type of the operands of the operatorop
- the operator upon two objects of type Rmap
- the mapping function which produces an object of type R from a JsValuepredicate
- the predicate that determines what JsValue will be mapped and reducedOptional
describing the of of the reductionto apply the reduction in all the Json and not only in the first level
public boolean equals(JsObj that, JsArray.TYPE ARRAY_AS)
that
- the given arrayARRAY_AS
- enum to specify if arrays are considered as lists or sets or multisetspublic boolean containsKey(String key)
key
- the keypublic JsArray getArray(String key)
key
- the keypublic JsArray getArray(String key, Supplier<JsArray> orElse)
key
- the keyorElse
- the default valuepublic BigDecimal getBigDec(String key)
key
- the keypublic BigDecimal getBigDec(String key, Supplier<BigDecimal> orElse)
key
- the keyorElse
- the default valuepublic byte[] getBinary(String key)
key
- the keypublic byte[] getBinary(String key, Supplier<byte[]> orElse)
key
- the keyorElse
- the default valuepublic BigInteger getBigInt(String key)
key
- the keypublic BigInteger getBigInt(String key, Supplier<BigInteger> orElse)
key
- the keyorElse
- the default valuepublic Instant getInstant(String key)
key
- the keypublic Instant getInstant(String key, Supplier<Instant> orElse)
key
- the keyorElse
- the default valuepublic Boolean getBool(String key)
key
- the keypublic Boolean getBool(String key, Supplier<Boolean> orElse)
key
- the keyorElse
- the default valuepublic Double getDouble(String key)
BigDecimal.doubleValue()
and in some cases it can lose information about
the precision of the BigDecimalkey
- the keypublic Double getDouble(String key, Supplier<Double> orElse)
BigDecimal.doubleValue()
and in some cases it can lose information about
the precision of the BigDecimalkey
- the keyorElse
- the default valuepublic Integer getInt(String key)
key
- the keypublic Integer getInt(String key, Supplier<Integer> orElse)
key
- the keyorElse
- the default valuepublic Long getLong(String key)
key
- the keypublic Long getLong(String key, Supplier<Long> orElse)
key
- the keyorElse
- the default valuepublic JsObj getObj(String key)
key
- the keypublic JsObj getObj(String key, Supplier<JsObj> orElse)
key
- the keyorElse
- the default valuepublic String getStr(String key)
key
- the keypublic String getStr(String key, Supplier<String> orElse)
key
- the keyorElse
- the default valuepublic int hashCode()
public String toString()
public boolean isObj()
JsValue
public JsObj intersection(JsObj that, JsArray.TYPE ARRAY_AS)
this.intersection(that, SET)
returns an array with the elements that exist in both this
and that
this.intersection(that, MULTISET)
returns an array with the elements that exist in both this
and that
,
being duplicates allowed.
this.intersection(that, LIST)
returns an array with the elements that exist in both this
and that
,
and are located at the same position.that
- the other objARRAY_AS
- option to define if arrays are considered SETS, LISTS OR MULTISETpublic JsObj intersectionAll(JsObj that, JsArray.TYPE ARRAY_AS)
this.intersectionAll(that)
behaves as this.intersection(that, LIST)
, but for those elements
that are containers of the same type and are located at the same position, the result is their
intersection. So this operation is kind of a 'recursive' intersection.that
- the other objectARRAY_AS
- option to define if arrays are considered SETS, LISTS OR MULTISETpublic JsObj union(JsObj that)
this
json object plus those pairs from the given json object that
which
keys don't exist in this
. Taking that into account, it's not a commutative operation unless
the elements associated with the keys that exist in both json objects are equals.that
- the given json objectpublic JsObj unionAll(JsObj that, JsArray.TYPE ARRAY_AS)
union(JsObj)
but, for those keys that exit in both this
and that
json objects,
which associated elements are **containers of the same type**, the result is their union. In this
case, we can specify if arrays are considered Sets, Lists, or MultiSets. So this operation is kind of a
'recursive' union.that
- the given json objectARRAY_AS
- option to define if arrays are considered SETS, LISTS OR MULTISETCopyright © 2022. All rights reserved.