Package org.geotools.data.util
Class CollectionConverterFactory
- Object
-
- CollectionConverterFactory
-
- All Implemented Interfaces:
ConverterFactory
public class CollectionConverterFactory extends Object implements ConverterFactory
Converts among arrays and different collection classes.THe following conversions are supported:
- Collection to Collection where collections are different types ( ex list to set )
- Collection to Array
- Array to Collection
- Array to Array where the declared type of the target array is assignable from the declared type of the source array
- Author:
- Justin Deoliveira, The Open Planning Project
-
-
Field Summary
Fields Modifier and Type Field Description protected static Converter
ArrayToArray
Converter for array to array.protected static Converter
ArrayToCollection
Converter for array to collection.protected static Converter
CollectionToArray
Converter for collection to array.protected static Converter
CollectionToCollection
Converter for collection to collection-
Fields inherited from interface ConverterFactory
SAFE_CONVERSION
-
-
Constructor Summary
Constructors Constructor Description CollectionConverterFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Converter
createConverter(Class<?> source, Class<?> target, Hints hints)
Creates aConverter
instance for converting one type of object to another.protected static Collection<Object>
newCollection(Class target)
-
-
-
Field Detail
-
CollectionToCollection
protected static final Converter CollectionToCollection
Converter for collection to collection
-
CollectionToArray
protected static final Converter CollectionToArray
Converter for collection to array.
-
ArrayToCollection
protected static final Converter ArrayToCollection
Converter for array to collection.
-
ArrayToArray
protected static final Converter ArrayToArray
Converter for array to array.
-
-
Method Detail
-
newCollection
protected static Collection<Object> newCollection(Class target) throws Exception
- Throws:
Exception
-
createConverter
public Converter createConverter(Class<?> source, Class<?> target, Hints hints)
Description copied from interface:ConverterFactory
Creates aConverter
instance for converting one type of object to another.- Specified by:
createConverter
in interfaceConverterFactory
- Parameters:
source
- The type to convert from.target
- The type to convert to.hints
- Hints used to be used while creating a converter.- Returns:
- The converter, or
null
if one could not be found.
-
-