@Singleton @Named public class ValueConverterToCollection extends AbstractValueConverterToContainer<Collection>
ELEMENT_ESCAPE_END, ELEMENT_ESCAPE_START, ELEMENT_SEPARATOR
Constructor and Description |
---|
ValueConverterToCollection()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
convertContainerEntry(Object element,
int index,
Collection container,
Object valueSource,
GenericType<? extends Collection> targetType,
Object value)
This method converts a single entry of a container.
|
protected <T extends Collection> |
createContainer(GenericType<T> targetType,
int length)
This method creates the according container for the given
containerType . |
Class<Collection> |
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<Collection> 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, Collection container, Object valueSource, GenericType<? extends Collection> targetType, Object value)
AbstractValueConverterToContainer
convertContainerEntry
in class AbstractValueConverterToContainer<Collection>
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.value
- is the original value to convert.protected <T extends Collection> T createContainer(GenericType<T> targetType, int length)
AbstractValueConverterToContainer
containerType
.createContainer
in class AbstractValueConverterToContainer<Collection>
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.