@Singleton @Named public class ValueConverterToMap extends AbstractValueConverterToContainer<Map>
ELEMENT_ESCAPE_END, ELEMENT_ESCAPE_START, ELEMENT_SEPARATOR
Constructor and Description |
---|
ValueConverterToMap()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
convertContainerEntry(Object element,
int index,
Map container,
Object valueSource,
GenericType<? extends Map> targetType,
Object originalValue)
This method converts a single entry of a container.
|
protected <T extends Map> |
createContainer(GenericType<T> targetType,
int length)
This method creates the according container for the given
containerType . |
Class<Map> |
getTargetType()
Is the guaranteed return-type of the
conversion . |
convert, convertFromArray, convertFromCollection, convertFromString, doInitialize, getCollectionReflectionUtil, getSourceType, setCollectionReflectionUtil
getComposedValueConverter, setComposedValueConverter
convert, getReflectionUtil, setReflectionUtil
createLogger, getLogger
doInitialized, getInitializationState, initialize
public Class<Map> getTargetType()
ValueConverter
conversion
. This
information is used externally to choose the most specific ValueConverter
that is
appropriate
for the conversion. Object
as target-type
while a specific
converter may have Collection
as target-type
. Now if an object
(compliant with the source-type
) needs to be converted to a
Collection
or List
, the specific converter is used while for other
objects the generic converter is chosen. target-type
is often more general than the actual
returned result
. So a ValueConverter
that converts
a comma-separated String
to an ArrayList
will typically declare
List
as target-type
.protected void convertContainerEntry(Object element, int index, Map container, Object valueSource, GenericType<? extends Map> targetType, Object originalValue)
AbstractValueConverterToContainer
convertContainerEntry
in class AbstractValueConverterToContainer<Map>
element
- is the single entry (element) of the container to convert.index
- is the index of the given element
in the order of occurrence.container
- is the current container where to add the given element
as entry.valueSource
- describes the source of the value or null
if NOT available.targetType
- is the target-type
to convert to.originalValue
- is the original value to convert.protected <T extends Map> T createContainer(GenericType<T> targetType, int length)
AbstractValueConverterToContainer
containerType
.createContainer
in class AbstractValueConverterToContainer<Map>
T
- is the generic type of targetType
.targetType
- is the GenericType
of the container.length
- is the length (or capacity) of the container to create.Copyright © 2001–2016 mmm-Team. All rights reserved.