public.javadoc.org.spincast.plugins.jacksonjson.SpincastJsonManager.html Maven / Gradle / Ivy
Show all versions of spincast-website Show documentation
SpincastJsonManager (org.spincast:spincast-framework 1.14.0 API)
org.spincast.plugins.jacksonjson
Class SpincastJsonManager
- java.lang.Object
-
- org.spincast.plugins.jacksonjson.SpincastJsonManager
-
- All Implemented Interfaces:
- JsonManager
public class SpincastJsonManager
extends Object
implements JsonManager
Spincast Jackson Json manager
-
-
Field Summary
Fields
Modifier and Type
Field and Description
static String
ENUM_SERIALIZER_FIELD_NAME_LABEL
static String
ENUM_SERIALIZER_FIELD_NAME_NAME
protected static org.slf4j.Logger
logger
-
Constructor Summary
Constructors
Constructor and Description
SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
JsonObjectFactory jsonObjectFactory,
Set<JsonMixinInfo> jsonMixinInfos,
SpincastJsonManagerConfig spincastJsonManagerConfig,
SpincastConfig spincastConfig,
JsonPathUtils jsonPathUtils,
SpincastUtils spincastUtils,
FormFactory formFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
Object
clone(Object originalObject)
Tries to clone an object to a JsonObject
or
a JsonArray
, if the object is not of
a primitive type (or BigDecimal
).
Object
clone(Object originalObject,
boolean mutable)
Tries to clone an object to a JsonObject
or
a JsonArray
, if the object is not of
a primitive type (or BigDecimal
).
JsonArray
cloneJsonArray(JsonArray jsonArray,
boolean mutable)
Deep copy of the JsonArray
, so any
modification to the original won't affect the
clone, and vice-versa.
JsonObject
cloneJsonObject(JsonObject jsonObject,
boolean mutable)
Deep copy of the JsonObject
, so any
modification to the original won't affect the
clone, and vice-versa.
protected void
configureEmptyBeans(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void
configureMixins(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void
configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Configuration of the ObjectMapper.
String
convertToJsonDate(Date date)
Converts a Date to a Json
date format.
Object
convertToNativeType(Object originalObject)
Convert a random object to a valid native JsonObject type, if
it's not already.
JsonObject
create()
Creates an empty JsonObject
JsonArray
createArray()
Creates an empty JsonArray
.
Form
createForm(String formName)
Creates an empty Form
, which is a JsonObject +
a validations container.
protected com.fasterxml.jackson.databind.ObjectMapper
createObjectManager()
Creates the ObjectMapper
JsonArray
enumsToFriendlyJsonArray(Enum<?>[] enumValues)
Convert the enums to an array of JsonObjects
that
have a ".name" property (the name()
of the enum)
and a ".label" property (the toString()
of the
enum).
JsonObject
enumToFriendlyJsonObject(Enum<?> enumValue)
Convert the enum value to a JsonObject
that
has a ".name" property (the name()
of the enum)
and a ".label" property (the toString()
of the
enum)
JsonObject
fromClasspathFile(String path)
Creates a JsonObject
from a classpath
Json file.
JsonArray
fromCollectionToJsonArray(Collection<?> collection)
Creates a JsonArray
from a random collection.
JsonObject
fromFile(File jsonFile)
Creates a JsonObject
from a Json file.
JsonObject
fromFile(String path)
Creates a JsonObject
from the path of
a file, on the file system.
JsonObject
fromInputStream(InputStream inputStream)
Creates a JsonObject
from an inputStream.
<T> T
fromInputStream(InputStream inputStream,
Class<T> clazz)
Creates an instance of the specified T
type
from a Json
inputStream.
JsonArray
fromInputStreamArray(InputStream inputStream)
Creates a JsonArray
from an inputStream.
Map<String,Object>
fromInputStreamToMap(InputStream inputStream)
Creates a Map<String, Object>
from a Json
inputStream.
JsonArray
fromListArray(List<?> elements)
Creates a JsonArray
from a List
of elements.
JsonObject
fromMap(Map<String,?> params)
Creates an empty JsonObject
based on the specified Map.
JsonObject
fromMap(Map<String,?> params,
boolean parseKeysAsJsonPaths)
Creates a JsonObject
based on the specified Map.
JsonObject
fromObject(Object object)
Creates a JsonObject
from a random object..
JsonObject
fromString(String jsonString)
Creates a JsonObject
from a Json
String.
<T> T
fromString(String jsonString,
Class<T> clazz)
Creates an instance of the specified T
type
from a Json
String.
JsonArray
fromStringArray(String jsonString)
Creates a JsonArray
from a Json
String.
Map<String,Object>
fromStringToMap(String jsonString)
Creates a Map<String, Object>
from a Json
String.
protected com.fasterxml.jackson.databind.JsonSerializer<BigDecimal>
getBigDecimalSerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<Date>
getDateSerializer()
Object
getElementAtJsonPath(JsonArray array,
String jsonPath)
Gets an element from the JsonArray
at the
specified JsonPath
.
Object
getElementAtJsonPath(JsonArray array,
String jsonPath,
Object defaultValue)
Gets an element from the JsonArray
at the
specified JsonPath
.
Object
getElementAtJsonPath(JsonObject obj,
String jsonPath)
Gets an element from the JsonObject
at the specified JsonPath
.
Object
getElementAtJsonPath(JsonObject obj,
String jsonPath,
Object defaultValue)
Gets an element from the JsonObject
at the specified JsonPath
.
protected com.fasterxml.jackson.databind.JsonSerializer<Enum<?>>
getEnumSerializer()
protected FormFactory
getFormFactory()
protected com.google.inject.Injector
getGuice()
protected com.fasterxml.jackson.databind.JsonSerializer<Instant>
getInstantSerializer()
protected com.fasterxml.jackson.core.util.DefaultPrettyPrinter
getJacksonPrettyPrinter()
protected String
getJacksonPrettyPrinterIndentation()
protected String
getJacksonPrettyPrinterNewline()
protected com.fasterxml.jackson.databind.JsonDeserializer<JsonArray>
getJsonArrayDeserializer()
protected com.fasterxml.jackson.databind.JsonSerializer<JsonArray>
getJsonArraySerializer()
protected Set<JsonMixinInfo>
getJsonMixinInfos()
protected com.fasterxml.jackson.databind.JsonDeserializer<JsonObject>
getJsonObjectDeserializer()
protected JsonObjectFactory
getJsonObjectFactory()
protected com.fasterxml.jackson.databind.JsonSerializer<JsonObject>
getJsonObjectSerializer()
protected JsonPathUtils
getJsonPathUtils()
protected int
getMaxNumberOfKeysWhenConvertingMapToJsonObject()
protected com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper()
protected SpincastConfig
getSpincastConfig()
protected SpincastJsonManagerConfig
getSpincastJsonManagerConfig()
protected SpincastUtils
getSpincastUtils()
protected void
injectDependencies(Object obj)
Once the deserialization of an Object is done,
we inject dependencies using Guice.
protected boolean
isAllowCommentsInJson()
Should comments be accepted in Json?
boolean
isElementExists(JsonArray array,
String jsonPath)
Does the array contain an element at
the specified JsonPath
(even if
null
)?
boolean
isElementExists(JsonObject obj,
String jsonPath)
Does the object contain an element at
the specified JsonPath
(even if
null
)?
Date
parseDateFromJson(String str)
Currently support ISO 8601 encoded dates.
void
putElementAtJsonPath(JsonObjectOrArray objOrArray,
String jsonPath,
Object value)
Puts an element in the object at the specified JsonPath
.
void
putElementAtJsonPath(JsonObjectOrArray objOrArray,
String jsonPath,
Object value,
boolean clone)
Puts a clone of the element in the object at the
specified JsonPath
.
protected void
registerCustomModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void
registerCustomTypeSerializerModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom serializers for some types.
protected void
registerJava8DatatypesModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void
registerJsonObjectModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom (de)serializers for JsonObject
void
removeElementAtJsonPath(JsonArray array,
String jsonPath)
Removes an element at the specified JsonPath
from the
array.
void
removeElementAtJsonPath(JsonObject obj,
String jsonPath)
Removes an element at the specified JsonPath
from the
object.
String
toJsonString(Object obj)
Gets the Json
String representation of
the specified object.
String
toJsonString(Object obj,
boolean pretty)
Gets the Json
String representation of the
specified object.
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
ENUM_SERIALIZER_FIELD_NAME_NAME
public static final String ENUM_SERIALIZER_FIELD_NAME_NAME
- See Also:
- Constant Field Values
-
ENUM_SERIALIZER_FIELD_NAME_LABEL
public static final String ENUM_SERIALIZER_FIELD_NAME_LABEL
- See Also:
- Constant Field Values
-
Constructor Detail
-
SpincastJsonManager
@Inject
public SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
JsonObjectFactory jsonObjectFactory,
@Nullable
Set<JsonMixinInfo> jsonMixinInfos,
SpincastJsonManagerConfig spincastJsonManagerConfig,
SpincastConfig spincastConfig,
JsonPathUtils jsonPathUtils,
SpincastUtils spincastUtils,
FormFactory formFactory)
-
Method Detail
-
getGuice
protected com.google.inject.Injector getGuice()
-
getJsonObjectFactory
protected JsonObjectFactory getJsonObjectFactory()
-
getJsonMixinInfos
protected Set<JsonMixinInfo> getJsonMixinInfos()
-
getSpincastJsonManagerConfig
protected SpincastJsonManagerConfig getSpincastJsonManagerConfig()
-
getSpincastConfig
protected SpincastConfig getSpincastConfig()
-
getJsonPathUtils
protected JsonPathUtils getJsonPathUtils()
-
getSpincastUtils
protected SpincastUtils getSpincastUtils()
-
getFormFactory
protected FormFactory getFormFactory()
-
getJacksonPrettyPrinter
protected com.fasterxml.jackson.core.util.DefaultPrettyPrinter getJacksonPrettyPrinter()
-
getJacksonPrettyPrinterNewline
protected String getJacksonPrettyPrinterNewline()
-
getJacksonPrettyPrinterIndentation
protected String getJacksonPrettyPrinterIndentation()
-
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-
createObjectManager
protected com.fasterxml.jackson.databind.ObjectMapper createObjectManager()
Creates the ObjectMapper
-
configureObjectMapper
protected void configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Configuration of the ObjectMapper.
-
isAllowCommentsInJson
protected boolean isAllowCommentsInJson()
Should comments be accepted in Json?
- See Also:
https://github.com/FasterXML/jackson-core/wiki/JsonParser-Features#support-for-non-standard-data-format-constructs
-
configureEmptyBeans
protected void configureEmptyBeans(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
configureMixins
protected void configureMixins(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
getJsonObjectSerializer
protected com.fasterxml.jackson.databind.JsonSerializer<JsonObject> getJsonObjectSerializer()
-
getEnumSerializer
protected com.fasterxml.jackson.databind.JsonSerializer<Enum<?>> getEnumSerializer()
-
getJsonArraySerializer
protected com.fasterxml.jackson.databind.JsonSerializer<JsonArray> getJsonArraySerializer()
-
getDateSerializer
protected com.fasterxml.jackson.databind.JsonSerializer<Date> getDateSerializer()
-
getInstantSerializer
protected com.fasterxml.jackson.databind.JsonSerializer<Instant> getInstantSerializer()
-
getBigDecimalSerializer
protected com.fasterxml.jackson.databind.JsonSerializer<BigDecimal> getBigDecimalSerializer()
-
getJsonObjectDeserializer
protected com.fasterxml.jackson.databind.JsonDeserializer<JsonObject> getJsonObjectDeserializer()
-
getJsonArrayDeserializer
protected com.fasterxml.jackson.databind.JsonDeserializer<JsonArray> getJsonArrayDeserializer()
-
registerCustomModules
protected void registerCustomModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
registerJsonObjectModule
protected void registerJsonObjectModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom (de)serializers for JsonObject
-
registerCustomTypeSerializerModule
protected void registerCustomTypeSerializerModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom serializers for some types.
-
registerJava8DatatypesModule
protected void registerJava8DatatypesModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
toJsonString
public String toJsonString(Object obj)
Description copied from interface: JsonManager
Gets the Json
String representation of
the specified object.
- Specified by:
toJsonString
in interface JsonManager
-
toJsonString
public String toJsonString(Object obj,
boolean pretty)
Description copied from interface: JsonManager
Gets the Json
String representation of the
specified object.
- Specified by:
toJsonString
in interface JsonManager
pretty
- if true
, the generated
String will be formatted.
-
injectDependencies
protected void injectDependencies(Object obj)
Once the deserialization of an Object is done,
we inject dependencies using Guice.
-
create
public JsonObject create()
Description copied from interface: JsonManager
Creates an empty JsonObject
- Specified by:
create
in interface JsonManager
-
createArray
public JsonArray createArray()
Description copied from interface: JsonManager
Creates an empty JsonArray
.
- Specified by:
createArray
in interface JsonManager
-
fromObject
public JsonObject fromObject(Object object)
Description copied from interface: JsonManager
Creates a JsonObject
from a random object..
- Specified by:
fromObject
in interface JsonManager
-
fromString
public <T> T fromString(String jsonString,
Class<T> clazz)
Description copied from interface: JsonManager
Creates an instance of the specified T
type
from a Json
String.
- Specified by:
fromString
in interface JsonManager
- Returns:
- the deserialized version of the
parameter or
null
if the parameter is
null
.
-
fromInputStream
public <T> T fromInputStream(InputStream inputStream,
Class<T> clazz)
Description copied from interface: JsonManager
Creates an instance of the specified T
type
from a Json
inputStream.
- Specified by:
fromInputStream
in interface JsonManager
- Returns:
- the deserialized version of the
parameter or
null
if the parameter is
null
.
-
fromStringToMap
public Map<String,Object> fromStringToMap(String jsonString)
Description copied from interface: JsonManager
Creates a Map<String, Object>
from a Json
String.
- Specified by:
fromStringToMap
in interface JsonManager
- Returns:
- the
Map
version of the
parameter or null
if the parameter is
null
.
-
fromInputStreamToMap
public Map<String,Object> fromInputStreamToMap(InputStream inputStream)
Description copied from interface: JsonManager
Creates a Map<String, Object>
from a Json
inputStream.
- Specified by:
fromInputStreamToMap
in interface JsonManager
- Returns:
- the
Map
version of the
parameter or null
if the parameter is
null
.
-
fromString
public JsonObject fromString(String jsonString)
Description copied from interface: JsonManager
Creates a JsonObject
from a Json
String.
- Specified by:
fromString
in interface JsonManager
- Returns:
- the
JsonObject
version of the
parameter or null
if the parameter is
null
.
-
fromMap
public JsonObject fromMap(Map<String,?> params)
Description copied from interface: JsonManager
Creates an empty JsonObject
based on the specified Map.
An attempt will be made to create a deep copy of every elements so
a modification won't affect any external references and vice-versa.
The keys will be used as is, not parsed as JsonPaths.
- Specified by:
fromMap
in interface JsonManager
- Returns:
- the
JsonObject
version of the
parameter or null
if the parameter is
null
.
-
fromMap
public JsonObject fromMap(Map<String,?> params,
boolean parseKeysAsJsonPaths)
Description copied from interface: JsonManager
Creates a JsonObject
based on the specified Map.
An attempt will be made to create a deep copy of every elements so
a modification won't affect any external references and vice-versa.
- Specified by:
fromMap
in interface JsonManager
parseKeysAsJsonPaths
- if true
, the keys will
be parsed as JsonPaths
, otherwise they will ne used
as is.
- Returns:
- the
JsonObject
version of the
parameter or null
if the parameter is
null
.
-
fromInputStream
public JsonObject fromInputStream(InputStream inputStream)
Description copied from interface: JsonManager
Creates a JsonObject
from an inputStream.
- Specified by:
fromInputStream
in interface JsonManager
- Returns:
- the
JsonObject
version of the
parameter or null
if the parameter is
null
.
-
fromFile
public JsonObject fromFile(File jsonFile)
Description copied from interface: JsonManager
Creates a JsonObject
from a Json file.
- Specified by:
fromFile
in interface JsonManager
- Returns:
- the deserialized
JsonObject
or null
if the file is
null
or doesn't exist.
-
fromFile
public JsonObject fromFile(String path)
Description copied from interface: JsonManager
Creates a JsonObject
from the path of
a file, on the file system.
- Specified by:
fromFile
in interface JsonManager
- Returns:
- the deserialized
JsonObject
or null
if the file is
null
or doesn't exist.
-
fromClasspathFile
public JsonObject fromClasspathFile(String path)
Description copied from interface: JsonManager
Creates a JsonObject
from a classpath
Json file.
- Specified by:
fromClasspathFile
in interface JsonManager
- Returns:
- the deserialized
JsonObject
or null
if the file doesn't exist.
-
fromCollectionToJsonArray
public JsonArray fromCollectionToJsonArray(Collection<?> collection)
Description copied from interface: JsonManager
Creates a JsonArray
from a random collection.
- Specified by:
fromCollectionToJsonArray
in interface JsonManager
-
fromStringArray
public JsonArray fromStringArray(String jsonString)
Description copied from interface: JsonManager
Creates a JsonArray
from a Json
String.
- Specified by:
fromStringArray
in interface JsonManager
- Returns:
- the
JsonArray
version of the
parameter or null
if the parameter
is null
.
-
fromListArray
public JsonArray fromListArray(List<?> elements)
Description copied from interface: JsonManager
Creates a JsonArray
from a List
of elements.
- Specified by:
fromListArray
in interface JsonManager
- Returns:
- the
JsonArray
version of the
parameter or null
if the parameter
is null
.
-
fromInputStreamArray
public JsonArray fromInputStreamArray(InputStream inputStream)
Description copied from interface: JsonManager
Creates a JsonArray
from an inputStream.
- Specified by:
fromInputStreamArray
in interface JsonManager
- Returns:
- the
JsonArray
version of the
parameter or null
if the parameter
is null
.
-
getMaxNumberOfKeysWhenConvertingMapToJsonObject
protected int getMaxNumberOfKeysWhenConvertingMapToJsonObject()
-
getElementAtJsonPath
public Object getElementAtJsonPath(JsonObject obj,
String jsonPath)
Description copied from interface: JsonManager
Gets an element from the JsonObject
at the specified JsonPath
.
- Specified by:
getElementAtJsonPath
in interface JsonManager
- Returns:
- the element or
null
if not found.
-
getElementAtJsonPath
public Object getElementAtJsonPath(JsonObject obj,
String jsonPath,
Object defaultValue)
Description copied from interface: JsonManager
Gets an element from the JsonObject
at the specified JsonPath
.
- Specified by:
getElementAtJsonPath
in interface JsonManager
- Returns:
- the element or
null
if not found.
-
getElementAtJsonPath
public Object getElementAtJsonPath(JsonArray array,
String jsonPath)
Description copied from interface: JsonManager
Gets an element from the JsonArray
at the
specified JsonPath
.
- Specified by:
getElementAtJsonPath
in interface JsonManager
- Returns:
- the element or
null
if not found.
-
getElementAtJsonPath
public Object getElementAtJsonPath(JsonArray array,
String jsonPath,
Object defaultValue)
Description copied from interface: JsonManager
Gets an element from the JsonArray
at the
specified JsonPath
.
- Specified by:
getElementAtJsonPath
in interface JsonManager
- Returns:
- the element or
null
if not found.
-
putElementAtJsonPath
public void putElementAtJsonPath(JsonObjectOrArray objOrArray,
String jsonPath,
Object value)
Description copied from interface: JsonManager
Puts an element in the object at the specified JsonPath
.
All the hierarchy to the end of the JsonPath
is created if required.
- Specified by:
putElementAtJsonPath
in interface JsonManager
-
putElementAtJsonPath
public void putElementAtJsonPath(JsonObjectOrArray objOrArray,
String jsonPath,
Object value,
boolean clone)
Description copied from interface: JsonManager
Puts a clone of the element in the object at the
specified JsonPath
.
All the hierarchy to the end of the JsonPath
is created if required.
- Specified by:
putElementAtJsonPath
in interface JsonManager
-
createForm
public Form createForm(String formName)
Description copied from interface: JsonManager
Creates an empty Form
, which is a JsonObject +
a validations container.
- Specified by:
createForm
in interface JsonManager
-
convertToJsonDate
public String convertToJsonDate(Date date)
Description copied from interface: JsonManager
Converts a Date to a Json
date format.
- Specified by:
convertToJsonDate
in interface JsonManager
-
parseDateFromJson
public Date parseDateFromJson(String str)
Currently support ISO 8601 encoded dates.
- Specified by:
parseDateFromJson
in interface JsonManager
-
convertToNativeType
public Object convertToNativeType(Object originalObject)
Description copied from interface: JsonManager
Convert a random object to a valid native JsonObject type, if
it's not already.
- Specified by:
convertToNativeType
in interface JsonManager
-
cloneJsonObject
public JsonObject cloneJsonObject(JsonObject jsonObject,
boolean mutable)
Description copied from interface: JsonManager
Deep copy of the JsonObject
, so any
modification to the original won't affect the
clone, and vice-versa.
Note that if the current object is immutable and
the mutable
parameter is set to false
,
then the current object will be returned as is, since no cloning
is required.
- Specified by:
cloneJsonObject
in interface JsonManager
mutable
- if true
the resulting
array and all its children will be mutable, otherwise
they will all be immutable.
-
cloneJsonArray
public JsonArray cloneJsonArray(JsonArray jsonArray,
boolean mutable)
Description copied from interface: JsonManager
Deep copy of the JsonArray
, so any
modification to the original won't affect the
clone, and vice-versa.
Note that if the current object is immutable and
the mutable
parameter is set to false
,
then the current array will be returned as is, since no cloning
is required.
- Specified by:
cloneJsonArray
in interface JsonManager
mutable
- if true
the resulting
array and all its children will be mutable, otherwise
they will all be immutable.
-
clone
public Object clone(Object originalObject)
Description copied from interface: JsonManager
Tries to clone an object to a JsonObject
or
a JsonArray
, if the object is not of
a primitive type (or BigDecimal
).
The cloning is made by serializing the Object to a
Json string, and deserializing back. So any (de)serialization
rules apply.
The non primitive object will be cloned to a JsonArray
if it is a :
-
JsonArray
-
Collection
-
Array
- Specified by:
clone
in interface JsonManager
-
clone
public Object clone(Object originalObject,
boolean mutable)
Description copied from interface: JsonManager
Tries to clone an object to a JsonObject
or
a JsonArray
, if the object is not of
a primitive type (or BigDecimal
).
The cloning is made by serializing the Object to a
Json string, and deserializing back. So any (de)serialization
rules apply.
The non primitive object will be cloned to a JsonArray
if it is a :
-
JsonArray
-
Collection
-
Array
- Specified by:
clone
in interface JsonManager
mutable
- if false
, the resulting
Object and all its potential children
will be immutable.
-
removeElementAtJsonPath
public void removeElementAtJsonPath(JsonObject obj,
String jsonPath)
Description copied from interface: JsonManager
Removes an element at the specified JsonPath
from the
object.
- Specified by:
removeElementAtJsonPath
in interface JsonManager
-
removeElementAtJsonPath
public void removeElementAtJsonPath(JsonArray array,
String jsonPath)
Description copied from interface: JsonManager
Removes an element at the specified JsonPath
from the
array.
- Specified by:
removeElementAtJsonPath
in interface JsonManager
-
isElementExists
public boolean isElementExists(JsonObject obj,
String jsonPath)
Description copied from interface: JsonManager
Does the object contain an element at
the specified JsonPath
(even if
null
)?
- Specified by:
isElementExists
in interface JsonManager
-
isElementExists
public boolean isElementExists(JsonArray array,
String jsonPath)
Description copied from interface: JsonManager
Does the array contain an element at
the specified JsonPath
(even if
null
)?
- Specified by:
isElementExists
in interface JsonManager
-
enumToFriendlyJsonObject
public JsonObject enumToFriendlyJsonObject(Enum<?> enumValue)
Description copied from interface: JsonManager
Convert the enum value to a JsonObject
that
has a ".name" property (the name()
of the enum)
and a ".label" property (the toString()
of the
enum)
- Specified by:
enumToFriendlyJsonObject
in interface JsonManager
-
enumsToFriendlyJsonArray
public JsonArray enumsToFriendlyJsonArray(Enum<?>[] enumValues)
Description copied from interface: JsonManager
Convert the enums to an array of JsonObjects
that
have a ".name" property (the name()
of the enum)
and a ".label" property (the toString()
of the
enum).
- Specified by:
enumsToFriendlyJsonArray
in interface JsonManager
Copyright © 2019. All rights reserved.