Class JsonObjectArrayBase
- All Implemented Interfaces:
JsonObjectOrArray
- Direct Known Subclasses:
JsonArrayDefault
,JsonObjectDefault
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionJsonObjectArrayBase
(boolean mutable, JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
clone()
abstract JsonObjectOrArray
clone
(boolean mutable) Clone the object.boolean
Does the object contain an element at theJsonPath
position (even ifnull
)?protected <T> T
getArrayFirst
(String jsonPath, boolean parseJsonPath, boolean hasdefaultElement, T defaultElement, JsonObjectDefault.IFirstElementGetter<T> firstElementGetter) Gets the first value (as BigDecimal) of aJsonArray
property of the object, using theJsonPath
to find the array.protected BigDecimal
getArrayFirstBigDecimal
(String key, boolean parseJsonPath, boolean hasdefaultElement, BigDecimal defaultElement) getArrayFirstBigDecimal
(String key, BigDecimal defaultElement) Gets the first value (as BigDecimal) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstBigDecimalNoKeyParsing
(String key, BigDecimal defaultElement) Gets the first value (as Boolean) of aJsonArray
property of the object, using theJsonPath
to find the array.protected Boolean
getArrayFirstBoolean
(String key, boolean parseJsonPath, boolean hasdefaultElement, Boolean defaultElement) getArrayFirstBoolean
(String key, Boolean defaultElement) Gets the first value (as Boolean) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstBooleanNoKeyParsing
(String key, Boolean defaultElement) byte[]
Gets the first value (as byte[]) of aJsonArray
property of the object, using theJsonPath
to find the array.protected byte[]
getArrayFirstBytesFromBase64String
(String key, boolean parseJsonPath, boolean hasdefaultElement, byte[] defaultElement) byte[]
getArrayFirstBytesFromBase64String
(String key, byte[] defaultElement) Gets the first value (as byte[]) of aJsonArray
property of the object, using theJsonPath
to find the array.byte[]
byte[]
getArrayFirstBytesFromBase64StringNoKeyParsing
(String key, byte[] defaultElement) getArrayFirstDate
(String key) Gets the first value (as Date) of aJsonArray
property of the object, using theJsonPath
to find the array.protected Date
getArrayFirstDate
(String jsonPath, boolean parseJsonPath, boolean hasdefaultElement, Date defaultElement) getArrayFirstDate
(String key, Date defaultElement) Gets the first value (as Date) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstDateNoKeyParsing
(String key, Date defaultElement) Gets the first value (as Double) of aJsonArray
property of the object, using theJsonPath
to find the array.protected Double
getArrayFirstDouble
(String key, boolean parseJsonPath, boolean hasdefaultElement, Double defaultElement) getArrayFirstDouble
(String key, Double defaultElement) Gets the first value (as Double) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstDoubleNoKeyParsing
(String key, Double defaultElement) getArrayFirstFloat
(String key) Gets the first value (as Float) of aJsonArray
property of the object, using theJsonPath
to find the array.protected Float
getArrayFirstFloat
(String key, boolean parseJsonPath, boolean hasdefaultElement, Float defaultElement) getArrayFirstFloat
(String key, Float defaultElement) Gets the first value (as Float) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstFloatNoKeyParsing
(String key, Float defaultElement) Gets the first value (as Instant) of aJsonArray
property of the object, using theJsonPath
to find the array.protected Instant
getArrayFirstInstant
(String jsonPath, boolean parseJsonPath, boolean hasdefaultElement, Instant defaultElement) getArrayFirstInstant
(String key, Instant defaultElement) Gets the first value (as Instant) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstInstantNoKeyParsing
(String key, Instant defaultElement) Gets the first value (as Integer) of aJsonArray
property of the object, using theJsonPath
to find the array.protected Integer
getArrayFirstInteger
(String key, boolean parseJsonPath, boolean hasdefaultElement, Integer defaultElement) getArrayFirstInteger
(String key, Integer defaultElement) Gets the first value (as Integer) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstIntegerNoKeyParsing
(String key, Integer defaultElement) Gets the first value (as JsonArray) of aJsonArray
property of the object, using theJsonPath
to find the array.protected JsonArray
getArrayFirstJsonArray
(String key, boolean parseJsonPath, boolean hasdefaultElement, JsonArray defaultElement) getArrayFirstJsonArray
(String key, JsonArray defaultElement) Gets the first value (as JsonArray) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstJsonArrayNoKeyParsing
(String key, JsonArray defaultElement) Gets the first value (as JsonObject) of aJsonArray
property of the object, using theJsonPath
to find the array.protected JsonObject
getArrayFirstJsonObject
(String key, boolean parseJsonPath, boolean hasdefaultElement, JsonObject defaultElement) getArrayFirstJsonObject
(String key, JsonObject defaultElement) Gets the first value (as JsonObject) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstJsonObjectNoKeyParsing
(String key, JsonObject defaultElement) getArrayFirstLong
(String key) Gets the first value (as Long) of aJsonArray
property of the object, using theJsonPath
to find the array.protected Long
getArrayFirstLong
(String key, boolean parseJsonPath, boolean hasdefaultElement, Long defaultElement) getArrayFirstLong
(String key, Long defaultElement) Gets the first value (as Long) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstLongNoKeyParsing
(String key, Long defaultElement) Gets the first value (as String) of aJsonArray
property of the object, using theJsonPath
to find the array.protected String
getArrayFirstString
(String key, boolean parseJsonPath, boolean hasdefaultElement, String defaultElement) getArrayFirstString
(String key, String defaultElement) Gets the first value (as String) of aJsonArray
property of the object, using theJsonPath
to find the array.getArrayFirstStringNoKeyParsing
(String key, String defaultElement) getBigDecimal
(String jsonPath) Gets an element asBigDecimal
using the specifiedJsonPath
.protected BigDecimal
getBigDecimal
(String jsonPath, boolean hasdefaultElement, BigDecimal defaultElement, boolean parseJsonPath) getBigDecimal
(String jsonPath, BigDecimal defaultElement) Gets an element asBigDecimal
using the specifiedJsonPath
.protected BigDecimal
getBigDecimalElement
(String jsonPath, boolean hasdefaultElement, BigDecimal defaultElement) protected BigDecimal
getBigDecimalFromObject
(Object object) getBigDecimalNoKeyParsing
(String jsonPath) getBigDecimalNoKeyParsing
(String jsonPath, BigDecimal defaultElement) getBoolean
(String jsonPath) Gets an element asBoolean
using the specifiedJsonPath
.protected Boolean
getBoolean
(String jsonPath, boolean hasdefaultElement, Boolean defaultElement, boolean parseJsonPath) getBoolean
(String jsonPath, Boolean defaultElement) Gets an element asBoolean
using the specifiedJsonPath
.protected Boolean
getBooleanElement
(String jsonPath, boolean hasdefaultElement, Boolean defaultElement) protected Boolean
getBooleanFromObject
(Object object) getBooleanNoKeyParsing
(String jsonPath) getBooleanNoKeyParsing
(String jsonPath, Boolean defaultElement) byte[]
getBytesFromBase64String
(String jsonPath) Gets a byte array, from a base 64 encoded element using the specifiedJsonPath
.protected byte[]
getBytesFromBase64String
(String jsonPath, boolean hasdefaultElement, byte[] defaultElement, boolean parseJsonPath) byte[]
getBytesFromBase64String
(String jsonPath, byte[] defaultElement) Gets a byte array, from a base 64 encoded element using the specifiedJsonPath
.protected byte[]
getBytesFromBase64StringElement
(String jsonPath, boolean hasdefaultElement, byte[] defaultElement) byte[]
getBytesFromBase64StringNoKeyParsing
(String jsonPath) byte[]
getBytesFromBase64StringNoKeyParsing
(String jsonPath, byte[] defaultElement) protected byte[]
Gets a UTC timezoned date from aISO 8601
date string element using the specifiedJsonPath
.protected Date
Gets a UTC timezoned date from aISO 8601
date string element using the specifiedJsonPath
.protected Date
getDateElement
(String jsonPath, boolean hasdefaultElement, Date defaultElement) protected Date
getDateFromObject
(Object object) getDateNoKeyParsing
(String jsonPath) getDateNoKeyParsing
(String jsonPath, Date defaultElement) protected Object
Gets an element asDouble
using the specifiedJsonPath
.protected Double
Gets an element asDouble
using the specifiedJsonPath
.protected Double
getDoubleElement
(String jsonPath, boolean hasdefaultElement, Double defaultElement) protected Double
getDoubleFromObject
(Object object) getDoubleNoKeyParsing
(String jsonPath) getDoubleNoKeyParsing
(String jsonPath, Double defaultElement) protected Object
getElement
(String key, boolean hasdefaultElement, Object defaultElement, boolean parseJsonPath) Gets the element at this key/jsonPath/index.protected abstract Object
getElementNoKeyParsing
(String key, boolean hasdefaultElement, Object defaultElement) Gets the element at this key/index, without key parsing.Gets an element asFloat
using the specifiedJsonPath
.protected Float
Gets an element asFloat
using the specifiedJsonPath
.protected Float
getFloatElement
(String jsonPath, boolean hasdefaultElement, Float defaultElement) protected Float
getFloatFromObject
(Object object) getFloatNoKeyParsing
(String jsonPath) getFloatNoKeyParsing
(String jsonPath, Float defaultElement) getInstant
(String jsonPath) Gets an Instant from aISO 8601
date string element using the specifiedJsonPath
.protected Instant
getInstant
(String jsonPath, boolean hasdefaultElement, Instant defaultElement, boolean parseJsonPath) getInstant
(String jsonPath, Instant defaultElement) Gets an Instant from aISO 8601
date string element using the specifiedJsonPath
.protected Instant
getInstantElement
(String jsonPath, boolean hasdefaultElement, Instant defaultElement) protected Instant
getInstantFromObject
(Object object) getInstantNoKeyParsing
(String jsonPath) getInstantNoKeyParsing
(String jsonPath, Instant defaultElement) getInteger
(String jsonPath) Gets an element asInteger
using the specifiedJsonPath
.protected Integer
getInteger
(String jsonPath, boolean hasdefaultElement, Integer defaultElement, boolean parseJsonPath) getInteger
(String jsonPath, Integer defaultElement) Gets an element asInteger
using the specifiedJsonPath
.protected Integer
getIntegerElement
(String jsonPath, boolean hasdefaultElement, Integer defaultElement) protected Integer
getIntegerFromObject
(Object object) getIntegerNoKeyParsing
(String jsonPath) getIntegerNoKeyParsing
(String jsonPath, Integer defaultElement) getJsonArray
(String jsonPath) Gets an element asJsonArray
using the specifiedJsonPath
.protected JsonArray
getJsonArray
(String jsonPath, boolean hasdefaultElement, JsonArray defaultElement, boolean parseJsonPath) getJsonArray
(String jsonPath, JsonArray defaultElement) Gets an element asJsonArray
using the specifiedJsonPath
.protected JsonArray
getJsonArrayFromObject
(Object object) getJsonArrayNoKeyParsing
(String jsonPath) getJsonArrayNoKeyParsing
(String jsonPath, JsonArray defaultElement) getJsonArrayOrEmpty
(String jsonPath) Gets an element asJsonArray
using the specifiedJsonPath
.getJsonArrayOrEmpty
(String jsonPath, boolean addIfDoesntExist) Gets an element asJsonArray
using the specifiedJsonPath
.getJsonArrayOrEmptyNoKeyParsing
(String jsonPath) protected JsonManager
getJsonObject
(String jsonPath) Gets an element asJsonObject
using the specifiedJsonPath
.protected JsonObject
getJsonObject
(String jsonPath, boolean hasdefaultElement, JsonObject defaultElement) protected JsonObject
getJsonObject
(String jsonPath, boolean hasdefaultElement, JsonObject defaultElement, boolean parseJsonPath) getJsonObject
(String jsonPath, JsonObject defaultElement) Gets an element asJsonObject
using the specifiedJsonPath
.protected JsonObject
getJsonObjectFromObject
(Object object) getJsonObjectNoKeyParsing
(String jsonPath) getJsonObjectNoKeyParsing
(String jsonPath, JsonObject defaultElement) getJsonObjectOrEmpty
(String jsonPath) Gets an element asJsonObject
using the specifiedJsonPath
.getJsonObjectOrEmpty
(String jsonPath, boolean addIfDoesntExist) Gets an element asJsonObject
using the specifiedJsonPath
.getJsonObjectOrEmptyNoKeyParsing
(String jsonPath) protected Map<String,
JsonObjectArrayBase.JsonPathCachingItem> Gets an element asLong
using the specifiedJsonPath
.protected Long
Gets an element asLong
using the specifiedJsonPath
.protected Long
getLongElement
(String jsonPath, boolean hasdefaultElement, Long defaultElement) protected Long
getLongFromObject
(Object object) getLongNoKeyParsing
(String jsonPath) getLongNoKeyParsing
(String jsonPath, Long defaultElement) Gets an untyped Object using the specifiedJsonPath
.protected Object
Gets an untyped Object using the specifiedJsonPath
.protected ObjectConverter
getObjectNoKeyParsing
(String jsonPath) getObjectNoKeyParsing
(String jsonPath, Object defaultElement) protected SpincastUtils
Gets an element asString
using the specifiedJsonPath
.protected String
protected String
Gets an element asString
using the specifiedJsonPath
.protected String
getStringFromObject
(Object object) getStringNoKeyParsing
(String jsonPath) getStringNoKeyParsing
(String jsonPath, String defaultElement) protected ElementTransformer
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.protected boolean
isCanBeConvertedToBigDecimal
(String jsonPath, boolean parseKey) boolean
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.protected boolean
isCanBeConvertedToBoolean
(String jsonPath, boolean parseKey) boolean
isCanBeConvertedToBooleanNoKeyParsing
(String jsonPath) 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.protected boolean
isCanBeConvertedToByteArray
(String jsonPath, boolean parseKey) boolean
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.protected boolean
isCanBeConvertedToDate
(String jsonPath, boolean parseKey) boolean
isCanBeConvertedToDateNoKeyParsing
(String jsonPath) 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.protected boolean
isCanBeConvertedToDouble
(String jsonPath, boolean parseKey) boolean
isCanBeConvertedToDoubleNoKeyParsing
(String jsonPath) 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.protected boolean
isCanBeConvertedToFloat
(String jsonPath, boolean parseKey) boolean
isCanBeConvertedToFloatNoKeyParsing
(String jsonPath) 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.protected boolean
isCanBeConvertedToInteger
(String jsonPath, boolean parseKey) boolean
isCanBeConvertedToIntegerNoKeyParsing
(String jsonPath) 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.protected boolean
isCanBeConvertedToJsonArray
(String jsonPath, boolean parseKey) boolean
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.protected boolean
isCanBeConvertedToJsonObject
(String jsonPath, boolean parseKey) boolean
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.protected boolean
isCanBeConvertedToLong
(String jsonPath, boolean parseKey) boolean
isCanBeConvertedToLongNoKeyParsing
(String jsonPath) 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.protected boolean
isCanBeConvertedToString
(String jsonPath, boolean parseKey) boolean
isCanBeConvertedToStringNoKeyParsing
(String jsonPath) boolean
Is this object/array mutable?boolean
Validates that the value at the specifiedJsonPath
exists and isnull
.boolean
isNullNoKeyParsing
(String jsonPath) boolean
isOfTypeBigDecimal
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeBigDecimal
, without requiring any conversion.boolean
isOfTypeBigDecimalNoKeyParsing
(String jsonPath) boolean
isOfTypeBoolean
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeBoolean
, without requiring any conversion.boolean
isOfTypeBoolean
(String jsonPath, boolean parseKey) boolean
isOfTypeBooleanNoKeyParsing
(String jsonPath) 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
isOfTypeByteArray
(String jsonPath, boolean acceptBase64StringToo, boolean parseKey) boolean
isOfTypeByteArrayNoKeyParsing
(String jsonPath, boolean acceptBase64StringToo) boolean
isOfTypeDate
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeDate
, without requiring any conversion.boolean
isOfTypeDate
(String jsonPath, boolean parseKey) boolean
isOfTypeDateNoKeyParsing
(String jsonPath) boolean
isOfTypeDouble
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeDouble
, without requiring any conversion.boolean
isOfTypeDouble
(String jsonPath, boolean parseKey) boolean
isOfTypeDoubleNoKeyParsing
(String jsonPath) boolean
isOfTypeeBigDecimal
(String jsonPath, boolean parseKey) boolean
isOfTypeFloat
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeFloat
, without requiring any conversion.boolean
isOfTypeFloat
(String jsonPath, boolean parseKey) boolean
isOfTypeFloatNoKeyParsing
(String jsonPath) boolean
isOfTypeInteger
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeInteger
, without requiring any conversion.boolean
isOfTypeInteger
(String jsonPath, boolean parseKey) boolean
isOfTypeIntegerNoKeyParsing
(String jsonPath) boolean
isOfTypeJsonArray
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeJsonArray
, without requiring any conversion.boolean
isOfTypeJsonArray
(String jsonPath, boolean parseKey) boolean
isOfTypeJsonArrayNoKeyParsing
(String jsonPath) boolean
isOfTypeJsonObject
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeJsonObject
, without requiring any conversion.boolean
isOfTypeJsonObject
(String jsonPath, boolean parseKey) boolean
isOfTypeJsonObjectNoKeyParsing
(String jsonPath) boolean
isOfTypeLong
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeLong
, without requiring any conversion.boolean
isOfTypeLong
(String jsonPath, boolean parseKey) boolean
isOfTypeLongNoKeyParsing
(String jsonPath) boolean
isOfTypeString
(String jsonPath) Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeString
, without requiring any conversion.boolean
isOfTypeString
(String jsonPath, boolean parseKey) boolean
isOfTypeStringNoKeyParsing
(String jsonPath) boolean
Does the object contain an element at theJsonPath
position (even ifnull
)?protected JsonObjectOrArray
protected abstract JsonObjectOrArray
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.TheJson
string representation of the object.toJsonString
(boolean pretty) TheJson
string representation of the object.toString()
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.abstract 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.boolean
validateIsNull
(String jsonPath, boolean parseKey) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.spincast.core.json.JsonObjectOrArray
clear, remove, size
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
defaultElementValidator
-
-
Constructor Details
-
JsonObjectArrayBase
public JsonObjectArrayBase(boolean mutable, JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter) Constructor
-
-
Method Details
-
isMutable
public boolean isMutable()Description copied from interface:JsonObjectOrArray
Is this object/array mutable?- Specified by:
isMutable
in interfaceJsonObjectOrArray
-
getJsonManager
-
getSpincastUtils
-
getObjectConverter
-
getdefaultElementValidator
-
getJsonPathCachingMap
-
getObject
Description copied from interface:JsonObjectOrArray
Gets an untyped Object using the specifiedJsonPath
.- Specified by:
getObject
in interfaceJsonObjectOrArray
- 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
Description copied from interface:JsonObjectOrArray
Gets an untyped Object using the specifiedJsonPath
.- Specified by:
getObject
in interfaceJsonObjectOrArray
- 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.
-
getObjectNoKeyParsing
-
getObjectNoKeyParsing
-
getObject
-
getJsonObject
Description copied from interface:JsonObjectOrArray
Gets an element asJsonObject
using the specifiedJsonPath
.- Specified by:
getJsonObject
in interfaceJsonObjectOrArray
- Returns:
- the object or
null
if not found.
-
getJsonObjectOrEmpty
Description copied from interface:JsonObjectOrArray
Gets an element asJsonObject
using the specifiedJsonPath
.- Specified by:
getJsonObjectOrEmpty
in interfaceJsonObjectOrArray
- Returns:
- the element or an empty
JsonObject
if not found or ifnull
. The emptyJsonObject
will not be added to the specified path.
-
getJsonObjectOrEmpty
Description copied from interface:JsonObjectOrArray
Gets an element asJsonObject
using the specifiedJsonPath
.- Specified by:
getJsonObjectOrEmpty
in interfaceJsonObjectOrArray
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
.
-
getJsonObject
Description copied from interface:JsonObjectOrArray
Gets an element asJsonObject
using the specifiedJsonPath
.- Specified by:
getJsonObject
in interfaceJsonObjectOrArray
- Returns:
- the object or the specified
defaultElement
if not found.
-
getJsonObject
protected JsonObject getJsonObject(String jsonPath, boolean hasdefaultElement, JsonObject defaultElement) -
getJsonObjectNoKeyParsing
-
getJsonObjectNoKeyParsing
-
getJsonObjectOrEmptyNoKeyParsing
-
getJsonObject
protected JsonObject getJsonObject(String jsonPath, boolean hasdefaultElement, JsonObject defaultElement, boolean parseJsonPath) -
getJsonObjectFromObject
-
getJsonArray
Description copied from interface:JsonObjectOrArray
Gets an element asJsonArray
using the specifiedJsonPath
.- Specified by:
getJsonArray
in interfaceJsonObjectOrArray
- Returns:
- the object or
null
if not found.
-
getJsonArrayOrEmpty
Description copied from interface:JsonObjectOrArray
Gets an element asJsonArray
using the specifiedJsonPath
.- Specified by:
getJsonArrayOrEmpty
in interfaceJsonObjectOrArray
- Returns:
- the element or an empty
JsonArray
if not found or ifnull
. The emptyJsonArray
will not be added to the specified path.
-
getJsonArrayOrEmpty
Description copied from interface:JsonObjectOrArray
Gets an element asJsonArray
using the specifiedJsonPath
.- Specified by:
getJsonArrayOrEmpty
in interfaceJsonObjectOrArray
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
.
-
getJsonArray
Description copied from interface:JsonObjectOrArray
Gets an element asJsonArray
using the specifiedJsonPath
.- Specified by:
getJsonArray
in interfaceJsonObjectOrArray
- Returns:
- the object or the specified
defaultElement
if not found.
-
getJsonArrayNoKeyParsing
-
getJsonArrayNoKeyParsing
-
getJsonArrayOrEmptyNoKeyParsing
-
getJsonArray
-
getJsonArrayFromObject
-
getString
Description copied from interface:JsonObjectOrArray
Gets an element asString
using the specifiedJsonPath
.- Specified by:
getString
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getString
Description copied from interface:JsonObjectOrArray
Gets an element asString
using the specifiedJsonPath
.- Specified by:
getString
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getString
-
getStringNoKeyParsing
-
getStringNoKeyParsing
-
getString
-
getStringFromObject
-
getInteger
Description copied from interface:JsonObjectOrArray
Gets an element asInteger
using the specifiedJsonPath
.- Specified by:
getInteger
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getInteger
Description copied from interface:JsonObjectOrArray
Gets an element asInteger
using the specifiedJsonPath
.- Specified by:
getInteger
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getIntegerElement
-
getIntegerNoKeyParsing
-
getIntegerNoKeyParsing
-
getInteger
-
getIntegerFromObject
-
getLong
Description copied from interface:JsonObjectOrArray
Gets an element asLong
using the specifiedJsonPath
.- Specified by:
getLong
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getLong
Description copied from interface:JsonObjectOrArray
Gets an element asLong
using the specifiedJsonPath
.- Specified by:
getLong
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getLongElement
-
getLongNoKeyParsing
-
getLongNoKeyParsing
-
getLong
-
getLongFromObject
-
getFloat
Description copied from interface:JsonObjectOrArray
Gets an element asFloat
using the specifiedJsonPath
.- Specified by:
getFloat
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getFloat
Description copied from interface:JsonObjectOrArray
Gets an element asFloat
using the specifiedJsonPath
.- Specified by:
getFloat
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getFloatElement
-
getFloatNoKeyParsing
-
getFloatNoKeyParsing
-
getFloat
-
getFloatFromObject
-
getDouble
Description copied from interface:JsonObjectOrArray
Gets an element asDouble
using the specifiedJsonPath
.- Specified by:
getDouble
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getDouble
Description copied from interface:JsonObjectOrArray
Gets an element asDouble
using the specifiedJsonPath
.- Specified by:
getDouble
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getDoubleElement
-
getDoubleNoKeyParsing
-
getDoubleNoKeyParsing
-
getDouble
-
getDoubleFromObject
-
getBoolean
Description copied from interface:JsonObjectOrArray
Gets an element asBoolean
using the specifiedJsonPath
.- Specified by:
getBoolean
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getBoolean
Description copied from interface:JsonObjectOrArray
Gets an element asBoolean
using the specifiedJsonPath
.- Specified by:
getBoolean
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getBooleanElement
-
getBooleanNoKeyParsing
-
getBooleanNoKeyParsing
-
getBoolean
-
getBooleanFromObject
-
getBigDecimal
Description copied from interface:JsonObjectOrArray
Gets an element asBigDecimal
using the specifiedJsonPath
.- Specified by:
getBigDecimal
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getBigDecimal
Description copied from interface:JsonObjectOrArray
Gets an element asBigDecimal
using the specifiedJsonPath
.- Specified by:
getBigDecimal
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getBigDecimalElement
protected BigDecimal getBigDecimalElement(String jsonPath, boolean hasdefaultElement, BigDecimal defaultElement) -
getBigDecimalNoKeyParsing
-
getBigDecimalNoKeyParsing
-
getBigDecimal
protected BigDecimal getBigDecimal(String jsonPath, boolean hasdefaultElement, BigDecimal defaultElement, boolean parseJsonPath) -
getBigDecimalFromObject
-
getBytesFromBase64String
Description copied from interface:JsonObjectOrArray
Gets a byte array, from a base 64 encoded element using the specifiedJsonPath
.- Specified by:
getBytesFromBase64String
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getBytesFromBase64String
Description copied from interface:JsonObjectOrArray
Gets a byte array, from a base 64 encoded element using the specifiedJsonPath
.- Specified by:
getBytesFromBase64String
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getBytesFromBase64StringElement
protected byte[] getBytesFromBase64StringElement(String jsonPath, boolean hasdefaultElement, byte[] defaultElement) -
getBytesFromBase64StringNoKeyParsing
-
getBytesFromBase64StringNoKeyParsing
-
getBytesFromBase64String
protected byte[] getBytesFromBase64String(String jsonPath, boolean hasdefaultElement, byte[] defaultElement, boolean parseJsonPath) -
getBytesFromBase64StringValueFromObject
-
getDate
Description copied from interface:JsonObjectOrArray
Gets a UTC timezoned date from aISO 8601
date string element using the specifiedJsonPath
.- Specified by:
getDate
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found.
-
getDate
Description copied from interface:JsonObjectOrArray
Gets a UTC timezoned date from aISO 8601
date string element using the specifiedJsonPath
.- Specified by:
getDate
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found.
-
getDateElement
-
getDateFromObject
-
getDateNoKeyParsing
-
getDateNoKeyParsing
-
getDate
-
getInstant
Description copied from interface:JsonObjectOrArray
Gets an Instant from aISO 8601
date string element using the specifiedJsonPath
.- Specified by:
getInstant
in interfaceJsonObjectOrArray
- Returns:
- the element or
null
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getInstant
Description copied from interface:JsonObjectOrArray
Gets an Instant from aISO 8601
date string element using the specifiedJsonPath
.- Specified by:
getInstant
in interfaceJsonObjectOrArray
- Returns:
- the element or the specified
defaultElement
if not found. - Throws:
CantConvertException
- if an existing element can't be converted to the required type.
-
getInstantElement
-
getInstantFromObject
-
getInstantNoKeyParsing
-
getInstantNoKeyParsing
-
getInstant
-
getArrayFirst
protected <T> T getArrayFirst(String jsonPath, boolean parseJsonPath, boolean hasdefaultElement, T defaultElement, JsonObjectDefault.IFirstElementGetter<T> firstElementGetter) -
getArrayFirstString
Description copied from interface:JsonObjectOrArray
Gets the first value (as String) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstString
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstString
Description copied from interface:JsonObjectOrArray
Gets the first value (as String) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstString
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstStringNoKeyParsing
-
getArrayFirstStringNoKeyParsing
-
getArrayFirstString
-
toJsonString
Description copied from interface:JsonObjectOrArray
TheJson
string representation of the object.- Specified by:
toJsonString
in interfaceJsonObjectOrArray
-
toJsonString
Description copied from interface:JsonObjectOrArray
TheJson
string representation of the object.- Specified by:
toJsonString
in interfaceJsonObjectOrArray
- Parameters:
pretty
- iftrue
, the generated String will be formatted.
-
toString
-
getArrayFirstJsonObject
Description copied from interface:JsonObjectOrArray
Gets the first value (as JsonObject) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstJsonObject
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstJsonObject
Description copied from interface:JsonObjectOrArray
Gets the first value (as JsonObject) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstJsonObject
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstJsonObjectNoKeyParsing
-
getArrayFirstJsonObjectNoKeyParsing
-
getArrayFirstJsonObject
protected JsonObject getArrayFirstJsonObject(String key, boolean parseJsonPath, boolean hasdefaultElement, JsonObject defaultElement) -
getArrayFirstJsonArray
Description copied from interface:JsonObjectOrArray
Gets the first value (as JsonArray) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstJsonArray
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstJsonArray
Description copied from interface:JsonObjectOrArray
Gets the first value (as JsonArray) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstJsonArray
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstJsonArrayNoKeyParsing
-
getArrayFirstJsonArrayNoKeyParsing
-
getArrayFirstJsonArray
-
getArrayFirstInteger
Description copied from interface:JsonObjectOrArray
Gets the first value (as Integer) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstInteger
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstInteger
Description copied from interface:JsonObjectOrArray
Gets the first value (as Integer) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstInteger
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstIntegerNoKeyParsing
-
getArrayFirstIntegerNoKeyParsing
-
getArrayFirstInteger
-
getArrayFirstLong
Description copied from interface:JsonObjectOrArray
Gets the first value (as Long) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstLong
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstLong
Description copied from interface:JsonObjectOrArray
Gets the first value (as Long) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstLong
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstLongNoKeyParsing
-
getArrayFirstLongNoKeyParsing
-
getArrayFirstLong
-
getArrayFirstDouble
Description copied from interface:JsonObjectOrArray
Gets the first value (as Double) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstDouble
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstDouble
Description copied from interface:JsonObjectOrArray
Gets the first value (as Double) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstDouble
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstDoubleNoKeyParsing
-
getArrayFirstDoubleNoKeyParsing
-
getArrayFirstDouble
-
getArrayFirstFloat
Description copied from interface:JsonObjectOrArray
Gets the first value (as Float) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstFloat
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstFloat
Description copied from interface:JsonObjectOrArray
Gets the first value (as Float) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstFloat
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstFloatNoKeyParsing
-
getArrayFirstFloatNoKeyParsing
-
getArrayFirstFloat
-
getArrayFirstBoolean
Description copied from interface:JsonObjectOrArray
Gets the first value (as Boolean) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstBoolean
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstBoolean
Description copied from interface:JsonObjectOrArray
Gets the first value (as Boolean) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstBoolean
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstBooleanNoKeyParsing
-
getArrayFirstBooleanNoKeyParsing
-
getArrayFirstBoolean
-
getArrayFirstBigDecimal
Description copied from interface:JsonObjectOrArray
Gets the first value (as BigDecimal) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstBigDecimal
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstBigDecimal
Description copied from interface:JsonObjectOrArray
Gets the first value (as BigDecimal) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstBigDecimal
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstBigDecimalNoKeyParsing
-
getArrayFirstBigDecimalNoKeyParsing
-
getArrayFirstBigDecimal
protected BigDecimal getArrayFirstBigDecimal(String key, boolean parseJsonPath, boolean hasdefaultElement, BigDecimal defaultElement) -
getArrayFirstBytesFromBase64String
Description copied from interface:JsonObjectOrArray
Gets the first value (as byte[]) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstBytesFromBase64String
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstBytesFromBase64String
Description copied from interface:JsonObjectOrArray
Gets the first value (as byte[]) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstBytesFromBase64String
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstBytesFromBase64StringNoKeyParsing
-
getArrayFirstBytesFromBase64StringNoKeyParsing
-
getArrayFirstBytesFromBase64String
protected byte[] getArrayFirstBytesFromBase64String(String key, boolean parseJsonPath, boolean hasdefaultElement, byte[] defaultElement) -
getArrayFirstDate
Description copied from interface:JsonObjectOrArray
Gets the first value (as Date) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstDate
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstDate
Description copied from interface:JsonObjectOrArray
Gets the first value (as Date) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstDate
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstDateNoKeyParsing
-
getArrayFirstDateNoKeyParsing
-
getArrayFirstDate
-
getArrayFirstInstant
Description copied from interface:JsonObjectOrArray
Gets the first value (as Instant) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstInstant
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or
null
if the array or the first element are not found.
-
getArrayFirstInstant
Description copied from interface:JsonObjectOrArray
Gets the first value (as Instant) of aJsonArray
property of the object, using theJsonPath
to find the array.- Specified by:
getArrayFirstInstant
in interfaceJsonObjectOrArray
- Returns:
- the value of the property or the specified
defaultElement
if the array or the first element are not found.
-
getArrayFirstInstantNoKeyParsing
-
getArrayFirstInstantNoKeyParsing
-
getArrayFirstInstant
-
isCanBeConvertedToString
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeString
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToString
in interfaceJsonObjectOrArray
-
isCanBeConvertedToStringNoKeyParsing
-
isCanBeConvertedToString
-
isCanBeConvertedToInteger
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeInteger
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToInteger
in interfaceJsonObjectOrArray
-
isCanBeConvertedToIntegerNoKeyParsing
-
isCanBeConvertedToInteger
-
isCanBeConvertedToLong
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeLong
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToLong
in interfaceJsonObjectOrArray
-
isCanBeConvertedToLongNoKeyParsing
-
isCanBeConvertedToLong
-
isCanBeConvertedToFloat
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeFloat
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToFloat
in interfaceJsonObjectOrArray
-
isCanBeConvertedToFloatNoKeyParsing
-
isCanBeConvertedToFloat
-
isCanBeConvertedToDouble
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeDouble
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToDouble
in interfaceJsonObjectOrArray
-
isCanBeConvertedToDoubleNoKeyParsing
-
isCanBeConvertedToDouble
-
isCanBeConvertedToBoolean
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeBoolean
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToBoolean
in interfaceJsonObjectOrArray
-
isCanBeConvertedToBooleanNoKeyParsing
-
isCanBeConvertedToBoolean
-
isCanBeConvertedToBigDecimal
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeBigDecimal
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToBigDecimal
in interfaceJsonObjectOrArray
-
isCanBeConvertedToBigDecimalNoKeyParsing
-
isCanBeConvertedToBigDecimal
-
isCanBeConvertedToByteArray
Description copied from interface:JsonObjectOrArray
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.- Specified by:
isCanBeConvertedToByteArray
in interfaceJsonObjectOrArray
-
isCanBeConvertedToByteArrayNoKeyParsing
-
isCanBeConvertedToByteArray
-
isCanBeConvertedToDate
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeDate
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToDate
in interfaceJsonObjectOrArray
-
isCanBeConvertedToDateNoKeyParsing
-
isCanBeConvertedToDate
-
isCanBeConvertedToJsonObject
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeJsonObject
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToJsonObject
in interfaceJsonObjectOrArray
-
isCanBeConvertedToJsonObjectNoKeyParsing
-
isCanBeConvertedToJsonObject
-
isCanBeConvertedToJsonArray
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
, of typeJsonArray
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToJsonArray
in interfaceJsonObjectOrArray
-
isCanBeConvertedToJsonArrayNoKeyParsing
-
isCanBeConvertedToJsonArray
-
isOfTypeString
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeString
, without requiring any conversion.- Specified by:
isOfTypeString
in interfaceJsonObjectOrArray
-
isOfTypeStringNoKeyParsing
-
isOfTypeString
-
isOfTypeInteger
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeInteger
, without requiring any conversion.- Specified by:
isOfTypeInteger
in interfaceJsonObjectOrArray
-
isOfTypeIntegerNoKeyParsing
-
isOfTypeInteger
-
isOfTypeLong
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeLong
, without requiring any conversion.- Specified by:
isOfTypeLong
in interfaceJsonObjectOrArray
-
isOfTypeLongNoKeyParsing
-
isOfTypeLong
-
isOfTypeFloat
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeFloat
, without requiring any conversion.- Specified by:
isOfTypeFloat
in interfaceJsonObjectOrArray
-
isOfTypeFloatNoKeyParsing
-
isOfTypeFloat
-
isOfTypeDouble
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeDouble
, without requiring any conversion.- Specified by:
isOfTypeDouble
in interfaceJsonObjectOrArray
-
isOfTypeDoubleNoKeyParsing
-
isOfTypeDouble
-
isOfTypeBoolean
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeBoolean
, without requiring any conversion.- Specified by:
isOfTypeBoolean
in interfaceJsonObjectOrArray
-
isOfTypeBooleanNoKeyParsing
-
isOfTypeBoolean
-
isOfTypeBigDecimal
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeBigDecimal
, without requiring any conversion.- Specified by:
isOfTypeBigDecimal
in interfaceJsonObjectOrArray
-
isOfTypeBigDecimalNoKeyParsing
-
isOfTypeeBigDecimal
-
isOfTypeByteArray
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typebyte[]
, without requiring any conversion.- Specified by:
isOfTypeByteArray
in interfaceJsonObjectOrArray
acceptBase64StringToo
- iftrue
, then a valid base 64 String will also be accepted.
-
isOfTypeByteArrayNoKeyParsing
-
isOfTypeByteArray
-
isOfTypeDate
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeDate
, without requiring any conversion.- Specified by:
isOfTypeDate
in interfaceJsonObjectOrArray
-
isOfTypeDateNoKeyParsing
-
isOfTypeDate
-
isOfTypeJsonObject
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeJsonObject
, without requiring any conversion.- Specified by:
isOfTypeJsonObject
in interfaceJsonObjectOrArray
-
isOfTypeJsonObjectNoKeyParsing
-
isOfTypeJsonObject
-
isOfTypeJsonArray
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and is currentlynull
or of typeJsonArray
, without requiring any conversion.- Specified by:
isOfTypeJsonArray
in interfaceJsonObjectOrArray
-
isOfTypeJsonArrayNoKeyParsing
-
isOfTypeJsonArray
-
isNull
Description copied from interface:JsonObjectOrArray
Validates that the value at the specifiedJsonPath
exists and isnull
.- Specified by:
isNull
in interfaceJsonObjectOrArray
-
isNullNoKeyParsing
-
validateIsNull
-
contains
Description copied from interface:JsonObjectOrArray
Does the object contain an element at theJsonPath
position (even ifnull
)?Same as
JsonObjectOrArray.isPresent(String)
.- Specified by:
contains
in interfaceJsonObjectOrArray
-
isPresent
Description copied from interface:JsonObjectOrArray
Does the object contain an element at theJsonPath
position (even ifnull
)?Same as
JsonObjectOrArray.contains(String)
.- Specified by:
isPresent
in interfaceJsonObjectOrArray
-
getElement
protected Object getElement(String key, boolean hasdefaultElement, Object defaultElement, boolean parseJsonPath) Gets the element at this key/jsonPath/index. If the current object is immutable, the target element may be cached. -
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
getTrimTransformer
-
trim
Description copied from interface:JsonObjectOrArray
Trims the element at the specifiedJsonPath
if it's of typeString
.- Specified by:
trim
in interfaceJsonObjectOrArray
-
trimAll
public void trimAll()Description copied from interface:JsonObjectOrArray
Trims all the elements of the object that are of typeString
. This transformation is not recursive.- Specified by:
trimAll
in interfaceJsonObjectOrArray
-
trimAll
public void trimAll(boolean recursive) Description copied from interface:JsonObjectOrArray
Trims all the elements of the object that are of type String.- Specified by:
trimAll
in interfaceJsonObjectOrArray
- Parameters:
recursive
- iftrue
, then all children elements will also be trimmed, recursively.
-
transform
Description copied from interface:JsonObjectOrArray
Transforms the element at the specifiedJsonPath
using the transformer.- Specified by:
transform
in interfaceJsonObjectOrArray
-
transformAll
Description copied from interface:JsonObjectOrArray
Transforms all the elements of the object, using the specified transformer. This transformation is not recursive.- Specified by:
transformAll
in interfaceJsonObjectOrArray
-
set
Description copied from interface:JsonObjectOrArray
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
- Specified by:
set
in interfaceJsonObjectOrArray
-
set
Description copied from interface:JsonObjectOrArray
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
- Specified by:
set
in interfaceJsonObjectOrArray
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
Description copied from interface:JsonObjectOrArray
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
- Specified by:
setIfAbsent
in interfaceJsonObjectOrArray
-
setIfAbsent
Description copied from interface:JsonObjectOrArray
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
- Specified by:
setIfAbsent
in interfaceJsonObjectOrArray
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.
-
put
protected JsonObjectOrArray put(String jsonPath, Object element, boolean clone, boolean parseJsonPath) -
putAsIs
-
transformAll
Description copied from interface:JsonObjectOrArray
Transforms all the elements of the object, using the specified transformer.- Specified by:
transformAll
in interfaceJsonObjectOrArray
recursive
- iftrue
, then all children elements will also be transformed, recursively.
-
clone
Clone the object.- Specified by:
clone
in interfaceJsonObjectOrArray
- Parameters:
mutable
- iftrue
the resulting object and all its children will be mutable, otherwise they will all be immutable.
-
getElementNoKeyParsing
protected abstract Object getElementNoKeyParsing(String key, boolean hasdefaultElement, Object defaultElement) Gets the element at this key/index, without key parsing.
-