Interface JsonObjectOrArray
- All Known Subinterfaces:
Form
,JsonArray
,JsonObject
,SpincastXmlManager.JsonArrayMixIn
,SpincastXmlManager.JsonObjectMixIn
- All Known Implementing Classes:
FormDefault
,JsonArrayDefault
,JsonObjectArrayBase
,JsonObjectDefault
,ValidationSetSimple
JsonObject
and
JsonArray
.-
Method Summary
Modifier and TypeMethodDescriptionclear()
Clears all elements.clone
(boolean mutable) Clone the object.boolean
Does the object contain an element at theJsonPath
position (even ifnull
)?getArrayFirstBigDecimal
(String jsonPath) Gets the first value (as BigDecimal) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstBigDecimal
(String jsonPath, BigDecimal defaultElement) Gets the first value (as BigDecimal) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstBoolean
(String jsonPath) Gets the first value (as Boolean) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstBoolean
(String jsonPath, Boolean defaultElement) Gets the first value (as Boolean) of aJsonArray
property of the object, using theJsonPath
to find the array.byte[]
getArrayFirstBytesFromBase64String
(String jsonPath) Gets the first value (as byte[]) of aJsonArray
property of the object, using theJsonPath
to find the array.byte[]
getArrayFirstBytesFromBase64String
(String jsonPath, byte[] defaultElement) Gets the first value (as byte[]) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstDate
(String jsonPath) Gets the first value (as Date) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstDate
(String jsonPath, Date defaultElement) Gets the first value (as Date) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstDouble
(String jsonPath) Gets the first value (as Double) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstDouble
(String jsonPath, Double defaultElement) Gets the first value (as Double) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstFloat
(String jsonPath) Gets the first value (as Float) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstFloat
(String jsonPath, Float defaultElement) Gets the first value (as Float) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstInstant
(String jsonPath) Gets the first value (as Instant) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstInstant
(String jsonPath, Instant defaultElement) Gets the first value (as Instant) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstInteger
(String jsonPath) Gets the first value (as Integer) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstInteger
(String jsonPath, Integer defaultElement) Gets the first value (as Integer) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstJsonArray
(String jsonPath) Gets the first value (as JsonArray) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstJsonArray
(String jsonPath, JsonArray defaultElement) Gets the first value (as JsonArray) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstJsonObject
(String jsonPath) Gets the first value (as JsonObject) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstJsonObject
(String jsonPath, JsonObject defaultElement) Gets the first value (as JsonObject) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstLong
(String jsonPath) Gets the first value (as Long) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstLong
(String jsonPath, Long defaultElement) Gets the first value (as Long) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstString
(String jsonPath) Gets the first value (as String) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstString
(String jsonPath, String defaultElement) Gets the first value (as String) of aJsonArray
property of the object, using theJsonPath
to find the array.getBigDecimal
(String jsonPath) Gets an element asBigDecimal
using the specifiedJsonPath
.getBigDecimal
(String jsonPath, BigDecimal defaultElement) Gets an element asBigDecimal
using the specifiedJsonPath
.getBoolean
(String jsonPath) Gets an element asBoolean
using the specifiedJsonPath
.getBoolean
(String jsonPath, Boolean defaultElement) Gets an element asBoolean
using the specifiedJsonPath
.byte[]
getBytesFromBase64String
(String jsonPath) Gets a byte array, from a base 64 encoded element using the specifiedJsonPath
.byte[]
getBytesFromBase64String
(String jsonPath, byte[] defaultElement) Gets a byte array, from a base 64 encoded element using the specifiedJsonPath
.Gets a UTC timezoned date from aISO 8601
date string element using the specifiedJsonPath
.Gets a UTC timezoned date from aISO 8601
date string element using the specifiedJsonPath
.Gets an element asDouble
using the specifiedJsonPath
.Gets an element asDouble
using the specifiedJsonPath
.Gets an element asFloat
using the specifiedJsonPath
.Gets an element asFloat
using the specifiedJsonPath
.getInstant
(String jsonPath) Gets an Instant from aISO 8601
date string element using the specifiedJsonPath
.getInstant
(String jsonPath, Instant defaultElement) Gets an Instant from aISO 8601
date string element using the specifiedJsonPath
.getInteger
(String jsonPath) Gets an element asInteger
using the specifiedJsonPath
.getInteger
(String jsonPath, Integer defaultElement) Gets an element asInteger
using the specifiedJsonPath
.getJsonArray
(String jsonPath) Gets an element asJsonArray
using the specifiedJsonPath
.getJsonArray
(String jsonPath, JsonArray defaultElement) Gets an element asJsonArray
using the specifiedJsonPath
.getJsonArrayOrEmpty
(String jsonPath) Gets an element asJsonArray
using the specifiedJsonPath
.getJsonArrayOrEmpty
(String jsonPath, boolean addIfDoesntExist) Gets an element asJsonArray
using the specifiedJsonPath
.getJsonObject
(String jsonPath) Gets an element asJsonObject
using the specifiedJsonPath
.getJsonObject
(String jsonPath, JsonObject defaultElement) Gets an element asJsonObject
using the specifiedJsonPath
.getJsonObjectOrEmpty
(String jsonPath) Gets an element asJsonObject
using the specifiedJsonPath
.getJsonObjectOrEmpty
(String jsonPath, boolean addIfDoesntExist) Gets an element asJsonObject
using the specifiedJsonPath
.Gets an element asLong
using the specifiedJsonPath
.Gets an element asLong
using the specifiedJsonPath
.Gets an untyped Object using the specifiedJsonPath
.Gets an untyped Object using the specifiedJsonPath
.Gets an element asString
using the specifiedJsonPath
.Gets an element asString
using the specifiedJsonPath
.boolean
isCanBeConvertedToBigDecimal
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeBigDecimal
, or can be converted and retrieved as one.boolean
isCanBeConvertedToBoolean
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeBoolean
, or can be converted and retrieved as one.boolean
isCanBeConvertedToByteArray
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typebase 64 String
representing a byte array, or can be converted and retrieved as one.boolean
isCanBeConvertedToDate
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeDate
, or can be converted and retrieved as one.boolean
isCanBeConvertedToDouble
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeDouble
, or can be converted and retrieved as one.boolean
isCanBeConvertedToFloat
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeFloat
, or can be converted and retrieved as one.boolean
isCanBeConvertedToInteger
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeInteger
, or can be converted and retrieved as one.boolean
isCanBeConvertedToJsonArray
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeJsonArray
, or can be converted and retrieved as one.boolean
isCanBeConvertedToJsonObject
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeJsonObject
, or can be converted and retrieved as one.boolean
isCanBeConvertedToLong
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeLong
, or can be converted and retrieved as one.boolean
isCanBeConvertedToString
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeString
, or can be converted and retrieved as one.boolean
Is this object/array mutable?boolean
Validates that the value at the specifiedJsonPath
exists and isnull
.boolean
isOfTypeBigDecimal
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeBigDecimal
, without requiring any conversion.boolean
isOfTypeBoolean
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeBoolean
, without requiring any conversion.boolean
isOfTypeByteArray
(String jsonPath, boolean acceptBase64StringToo) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typebyte[]
, without requiring any conversion.boolean
isOfTypeDate
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeDate
, without requiring any conversion.boolean
isOfTypeDouble
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeDouble
, without requiring any conversion.boolean
isOfTypeFloat
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeFloat
, without requiring any conversion.boolean
isOfTypeInteger
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeInteger
, without requiring any conversion.boolean
isOfTypeJsonArray
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeJsonArray
, without requiring any conversion.boolean
isOfTypeJsonObject
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeJsonObject
, without requiring any conversion.boolean
isOfTypeLong
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeLong
, without requiring any conversion.boolean
isOfTypeString
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeString
, without requiring any conversion.boolean
Does the object contain an element at theJsonPath
position (even ifnull
)?Removes an element atJsonPath
.Sets an element at the specifiedJsonPath
.Sets an element at the specifiedJsonPath
.setIfAbsent
(String jsonPath, Object element) Sets an element at the specifiedJsonPath
if no element exists at this path.setIfAbsent
(String jsonPath, Object element, boolean clone) Sets an element at the specifiedJsonPath
if no element exists at this path.int
size()
The size of the object.TheJson
string representation of the object.toJsonString
(boolean pretty) TheJson
string representation of the object.void
transform
(String jsonPath, ElementTransformer transformer) Transforms the element at the specifiedJsonPath
using the transformer.void
transformAll
(ElementTransformer transformer) Transforms all the elements of the object, using the specified transformer.void
transformAll
(ElementTransformer transformer, boolean recursive) Transforms all the elements of the object, using the specified transformer.void
Trims the element at the specifiedJsonPath
if it's of typeString
.void
trimAll()
Trims all the elements of the object that are of typeString
.void
trimAll
(boolean recursive) Trims all the elements of the object that are of type String.
-
Method Details
-
transform
Transforms the element at the specifiedJsonPath
using the transformer. -
isMutable
boolean isMutable()Is this object/array mutable? -
clear
JsonObjectOrArray clear()Clears all elements. -
size
int size()The size of the object. -
toJsonString
String toJsonString()TheJson
string representation of the object. -
toJsonString
TheJson
string representation of the object.- Parameters:
pretty
- iftrue
, the generated String will be formatted.
-
clone
Clone the object.- Parameters:
mutable
- iffalse
, the resulting object will be immutable.
-
transformAll
Transforms all the elements of the object, using the specified transformer. This transformation is not recursive. -
transformAll
Transforms all the elements of the object, using the specified transformer.- Parameters:
recursive
- iftrue
, then all children elements will also be transformed, recursively.
-
trim
Trims the element at the specifiedJsonPath
if it's of typeString
. -
trimAll
void trimAll()Trims all the elements of the object that are of typeString
. This transformation is not recursive. -
trimAll
void trimAll(boolean recursive) Trims all the elements of the object that are of type String.- Parameters:
recursive
- iftrue
, then all children elements will also be trimmed, recursively.
-
contains
Does the object contain an element at theJsonPath
position (even ifnull
)?Same as
isPresent(String)
. -
isPresent
Does the object contain an element at theJsonPath
position (even ifnull
)?Same as
contains(String)
. -
remove
Removes an element atJsonPath
.- Returns:
- the current object (fluent style).
-
set
Sets an element at the specifiedJsonPath
. Overwrites any existing element at thatJsonPath
.The required hierarchy will be created, if required, to support the
JsonPath
.If the object to add is not of a JsonObject's native type, the object is converted to a JsonObject or a JsonArray before being added. Once the object is converted and added, a modification to the original object won't affect the added element, and vice-versa.
If the element to add is a
JsonObject
or aJsonArray
and is immutable then it will be cloned. Doing so, we can make sure that the current object is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to aJsonArray
using the associated conversion method.Those are the types of object that will be converted to a JsonArray instead of a JsonObject, if no conversion interface is implemented :
- A Collection
- An array
-
set
Sets an element at the specifiedJsonPath
. Overwrites any existing element at thatJsonPath
.The required hierarchy will be created, if required, to support the
JsonPath
.If the object to add is not of a JsonObject's native type, the object is converted to a JsonObject or a JsonArray before being added. Once the object is converted and added, a modification to the original object won't affect the added element, and vice-versa.
If the element to add is a
JsonObject
or aJsonArray
and is immutable then it will be cloned. Doing so, we can make sure that the current object is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to aJsonArray
using the associated conversion method.Those are the types of object that will be converted to a JsonArray instead of a JsonObject, if no conversion interface is implemented :
- A Collection
- An array
- Parameters:
clone
- iftrue
, and the element to add is aJsonObject
orJsonArray
, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure the current object is always fully mutable or fully immutable.
-
setIfAbsent
Sets an element at the specifiedJsonPath
if no element exists at this path.The required hierarchy will be created, if required, to support the
JsonPath
.If the object to add is not of a JsonObject's native type, the object is converted to a JsonObject or a JsonArray before being added. Once the object is converted and added, a modification to the original object won't affect the added element, and vice-versa.
If the element to add is a
JsonObject
or aJsonArray
and is immutable then it will be cloned. Doing so, we can make sure that the current object is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to aJsonArray
using the associated conversion method.Those are the types of object that will be converted to a JsonArray instead of a JsonObject, if no conversion interface is implemented :
- A Collection
- An array
-
setIfAbsent
Sets an element at the specifiedJsonPath
if no element exists at this path.The required hierarchy will be created, if required, to support the
JsonPath
.If the object to add is not of a JsonObject's native type, the object is converted to a JsonObject or a JsonArray before being added. Once the object is converted and added, a modification to the original object won't affect the added element, and vice-versa.
If the element to add is a
JsonObject
or aJsonArray
and is immutable then it will be cloned. Doing so, we can make sure that the current object is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to aJsonArray
using the associated conversion method.Those are the types of object that will be converted to a JsonArray instead of a JsonObject, if no conversion interface is implemented :
- A Collection
- An array
- Parameters:
clone
- iftrue
, and the element to add is aJsonObject
orJsonArray
, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure the current object is always fully mutable or fully immutable.
-
getJsonObject
Gets an element asJsonObject
using the specifiedJsonPath
.- Returns:
- the object or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getJsonObject
Gets an element asJsonObject
using the specifiedJsonPath
.- Returns:
- the object or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getJsonObjectOrEmpty
Gets an element asJsonObject
using the specifiedJsonPath
.- Returns:
- the element or an empty
JsonObject
if not found or ifnull
. The emptyJsonObject
will not be added to the specified path. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getJsonObjectOrEmpty
JsonObject getJsonObjectOrEmpty(String jsonPath, boolean addIfDoesntExist) throws CantConvertException Gets an element asJsonObject
using the specifiedJsonPath
.- Parameters:
addIfDoesntExist
- iftrue
and the element doesn't exist, the created emptyJsonObject
will be added to the specifiedJsonPath
.- Returns:
- the element or an empty
JsonObject
if not found or ifnull
. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getJsonArray
Gets an element asJsonArray
using the specifiedJsonPath
.- Returns:
- the object or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getJsonArray
Gets an element asJsonArray
using the specifiedJsonPath
.- Returns:
- the object or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getJsonArrayOrEmpty
Gets an element asJsonArray
using the specifiedJsonPath
.- Returns:
- the element or an empty
JsonArray
if not found or ifnull
. The emptyJsonArray
will not be added to the specified path. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getJsonArrayOrEmpty
JsonArray getJsonArrayOrEmpty(String jsonPath, boolean addIfDoesntExist) throws CantConvertException Gets an element asJsonArray
using the specifiedJsonPath
.- Parameters:
addIfDoesntExist
- iftrue
and the element doesn't exist, the created emptyJsonArray
will be added to the specifiedJsonPath
.- Returns:
- the element or an empty
JsonArray
if not found or ifnull
. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getString
Gets an element asString
using the specifiedJsonPath
.- Returns:
- the element or
null
if not found.
-
getString
Gets an element asString
using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found.
-
getInteger
Gets an element asInteger
using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getInteger
Gets an element asInteger
using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getLong
Gets an element asLong
using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getLong
Gets an element asLong
using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getFloat
Gets an element asFloat
using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getFloat
Gets an element asFloat
using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getDouble
Gets an element asDouble
using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getDouble
Gets an element asDouble
using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getBoolean
Gets an element asBoolean
using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getBoolean
Gets an element asBoolean
using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getBigDecimal
Gets an element asBigDecimal
using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getBigDecimal
Gets an element asBigDecimal
using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getBytesFromBase64String
Gets a byte array, from a base 64 encoded element using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getBytesFromBase64String
Gets a byte array, from a base 64 encoded element using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getDate
Gets a UTC timezoned date from aISO 8601
date string element using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getDate
Gets a UTC timezoned date from aISO 8601
date string element using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getInstant
Gets an Instant from aISO 8601
date string element using the specifiedJsonPath
.- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getInstant
Gets an Instant from aISO 8601
date string element using the specifiedJsonPath
.- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getObject
Gets an untyped Object using the specifiedJsonPath
.- Returns:
- the object or
null
if not found. This object will necessarily be of a type managed byJsonObjectOrArray
, since an object of any other type is automatically converted when added.
-
getObject
Gets an untyped Object using the specifiedJsonPath
.- Returns:
- the object or the specified
defaultElement
if not found. This object will necessarily be of a type managed byJsonObjectOrArray
, since an object of any other type is automatically converted when added.
-
getArrayFirstJsonObject
Gets the first value (as JsonObject) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstJsonObject
JsonObject getArrayFirstJsonObject(String jsonPath, JsonObject defaultElement) throws CantConvertException Gets the first value (as JsonObject) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstJsonArray
Gets the first value (as JsonArray) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstJsonArray
JsonArray getArrayFirstJsonArray(String jsonPath, JsonArray defaultElement) throws CantConvertException Gets the first value (as JsonArray) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstString
Gets the first value (as String) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstString
Gets the first value (as String) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstInteger
Gets the first value (as Integer) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstInteger
Gets the first value (as Integer) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstLong
Gets the first value (as Long) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstLong
Gets the first value (as Long) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstDouble
Gets the first value (as Double) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstDouble
Gets the first value (as Double) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstFloat
Gets the first value (as Float) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstFloat
Gets the first value (as Float) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstBoolean
Gets the first value (as Boolean) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstBoolean
Gets the first value (as Boolean) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstBigDecimal
Gets the first value (as BigDecimal) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstBigDecimal
BigDecimal getArrayFirstBigDecimal(String jsonPath, BigDecimal defaultElement) throws CantConvertException Gets the first value (as BigDecimal) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstBytesFromBase64String
Gets the first value (as byte[]) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstBytesFromBase64String
byte[] getArrayFirstBytesFromBase64String(String jsonPath, byte[] defaultElement) throws CantConvertException Gets the first value (as byte[]) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstDate
Gets the first value (as Date) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstDate
Gets the first value (as Date) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstInstant
Gets the first value (as Instant) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or
null
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getArrayFirstInstant
Gets the first value (as Instant) of aJsonArray
property of the object, using theJsonPath
to find the array.- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
isCanBeConvertedToString
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeString
, or can be converted and retrieved as one. -
isCanBeConvertedToInteger
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeInteger
, or can be converted and retrieved as one. -
isCanBeConvertedToLong
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeLong
, or can be converted and retrieved as one. -
isCanBeConvertedToFloat
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeFloat
, or can be converted and retrieved as one. -
isCanBeConvertedToDouble
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeDouble
, or can be converted and retrieved as one. -
isCanBeConvertedToBoolean
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeBoolean
, or can be converted and retrieved as one. -
isCanBeConvertedToBigDecimal
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeBigDecimal
, or can be converted and retrieved as one. -
isCanBeConvertedToByteArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typebase 64 String
representing a byte array, or can be converted and retrieved as one. -
isCanBeConvertedToDate
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeDate
, or can be converted and retrieved as one. -
isCanBeConvertedToJsonObject
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeJsonObject
, or can be converted and retrieved as one. -
isCanBeConvertedToJsonArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeJsonArray
, or can be converted and retrieved as one. -
isOfTypeString
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeString
, without requiring any conversion. -
isOfTypeInteger
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeInteger
, without requiring any conversion. -
isOfTypeLong
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeLong
, without requiring any conversion. -
isOfTypeFloat
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeFloat
, without requiring any conversion. -
isOfTypeDouble
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeDouble
, without requiring any conversion. -
isOfTypeBoolean
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeBoolean
, without requiring any conversion. -
isOfTypeBigDecimal
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeBigDecimal
, without requiring any conversion. -
isOfTypeByteArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typebyte[]
, without requiring any conversion.- Parameters:
acceptBase64StringToo
- iftrue
, then a valid base 64 String will also be accepted.
-
isOfTypeDate
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeDate
, without requiring any conversion. -
isOfTypeJsonObject
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeJsonObject
, without requiring any conversion. -
isOfTypeJsonArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeJsonArray
, without requiring any conversion. -
isNull
Validates that the value at the specifiedJsonPath
exists and isnull
.
-