public class CollectionConverter<T> extends java.lang.Object implements TypeConverter<java.util.Collection<T>>
Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<? extends java.util.Collection> |
collectionType |
protected java.lang.Class<T> |
targetComponentType |
protected TypeConverterManager |
typeConverterManager |
Constructor and Description |
---|
CollectionConverter(java.lang.Class<? extends java.util.Collection> collectionType,
java.lang.Class<T> targetComponentType) |
CollectionConverter(TypeConverterManager typeConverterManager,
java.lang.Class<? extends java.util.Collection> collectionType,
java.lang.Class<T> targetComponentType) |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<T> |
convert(java.lang.Object value)
Converts object received as parameter into object of another class.
|
protected java.util.Collection<T> |
convertCollectionToCollection(java.util.Collection value)
Converts collection value to target collection.
|
protected java.util.Collection<T> |
convertPrimitiveArrayToCollection(java.lang.Object value,
java.lang.Class primitiveComponentType)
Converts primitive array to target collection.
|
protected java.util.Collection<T> |
convertToSingleElementCollection(java.lang.Object value)
Creates a collection with single element.
|
protected T |
convertType(java.lang.Object value)
Converts type using type converter manager.
|
protected java.util.Collection<T> |
convertValueToCollection(java.lang.Object value)
Converts non-collection value to collection.
|
protected java.util.Collection<T> |
createCollection(int length)
Creates new collection of target component type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convert
protected final TypeConverterManager typeConverterManager
protected final java.lang.Class<? extends java.util.Collection> collectionType
protected final java.lang.Class<T> targetComponentType
public CollectionConverter(java.lang.Class<? extends java.util.Collection> collectionType, java.lang.Class<T> targetComponentType)
public CollectionConverter(TypeConverterManager typeConverterManager, java.lang.Class<? extends java.util.Collection> collectionType, java.lang.Class<T> targetComponentType)
public java.util.Collection<T> convert(java.lang.Object value)
TypeConverter
Integer
converter tries to convert given objects
into target Integer
object. Converters should try all reasonable
ways of conversion into target object, depending on target type.convert
in interface TypeConverter<java.util.Collection<T>>
value
- object to convert fromprotected T convertType(java.lang.Object value)
protected java.util.Collection<T> createCollection(int length)
protected java.util.Collection<T> convertToSingleElementCollection(java.lang.Object value)
protected java.util.Collection<T> convertValueToCollection(java.lang.Object value)
protected java.util.Collection<T> convertCollectionToCollection(java.util.Collection value)
protected java.util.Collection<T> convertPrimitiveArrayToCollection(java.lang.Object value, java.lang.Class primitiveComponentType)
Copyright © 2003-present Jodd Team