public class JsonUtilImpl extends AbstractLoggableComponent implements JsonUtil
JsonUtil
.getInstance()
Modifier and Type | Field and Description |
---|---|
private CollectionReflectionUtil |
collectionReflectionUtil |
private static JsonUtil |
instance |
private StringUtil |
stringUtil |
Constructor and Description |
---|
JsonUtilImpl()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doInitialize()
This method performs the actual
initialization . |
protected void |
doInitialized()
This method is invoked at the end of the actual
initialization . |
static JsonUtil |
getInstance()
This method gets the singleton instance of this
JsonUtilImpl . |
<T> T |
read(javax.json.stream.JsonParser json,
GenericType<T> type,
javax.json.stream.JsonParser.Event e) |
<E> void |
readCollection(javax.json.stream.JsonParser json,
Collection<E> collection,
GenericType<E> type) |
<C extends Collection<?>> |
readCollection(javax.json.stream.JsonParser json,
GenericType<C> type) |
<E extends Enum<E>> |
readEnum(javax.json.stream.JsonParser json,
Class<E> enumType) |
<M extends Map<?,?>> |
readMap(javax.json.stream.JsonParser json,
GenericType<M> type) |
void |
setCollectionReflectionUtil(CollectionReflectionUtil collectionReflectionUtil) |
void |
setStringUtil(StringUtil stringUtil) |
createLogger, getLogger
getInitializationState, initialize
private static JsonUtil instance
private StringUtil stringUtil
private CollectionReflectionUtil collectionReflectionUtil
@Inject public void setStringUtil(StringUtil stringUtil)
stringUtil
- is the StringUtil
to Inject
.@Inject public void setCollectionReflectionUtil(CollectionReflectionUtil collectionReflectionUtil)
collectionReflectionUtil
- is the CollectionReflectionUtil
to Inject
.protected void doInitialize()
AbstractComponent
initialization
. It is called when AbstractComponent.initialize()
is
invoked for the first time. super.
AbstractComponent.doInitialize()
.doInitialize
in class AbstractLoggableComponent
protected void doInitialized()
AbstractComponent
initialization
. It is called when
AbstractComponent.initialize()
is invoked for the first time after AbstractComponent.doInitialize()
is completed and
initialization-state
has changed to initialized
. super.
AbstractComponent.doInitialized()
.doInitialized
in class AbstractComponent
public static JsonUtil getInstance()
JsonUtilImpl
. Cdi.GET_INSTANCE
before using.public <T> T read(javax.json.stream.JsonParser json, GenericType<T> type, javax.json.stream.JsonParser.Event e)
read
in interface JsonUtil
T
- the generic type of the object to parse.json
- the JsonParser
.type
- the GenericType
of the requested object to parse.e
- the current JsonParser.Event
.public <E extends Enum<E>> E readEnum(javax.json.stream.JsonParser json, Class<E> enumType) throws IllegalCaseException
public <C extends Collection<?>> C readCollection(javax.json.stream.JsonParser json, GenericType<C> type)
readCollection
in interface JsonUtil
C
- the generic type of the Collection
.json
- the JsonParser
.type
- the GenericType
of the Collection
.Collection
.public <E> void readCollection(javax.json.stream.JsonParser json, Collection<E> collection, GenericType<E> type)
readCollection
in interface JsonUtil
E
- the generic type of the elements
in the Collection
.json
- the JsonParser
.collection
- the Collection
where to add
the elements parsed from JSON.type
- the GenericType
of the elements
in the Collection
.public <M extends Map<?,?>> M readMap(javax.json.stream.JsonParser json, GenericType<M> type)
Copyright © 2001–2016 mmm-Team. All rights reserved.