public final class Converters extends Object
Constructor and Description |
---|
Converters() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
convert(Object source,
Class<T> target)
Converts an object of a particular type into an object of a different type.
|
static <T> T |
convert(Object source,
Class<T> target,
Hints hints)
Converts an object of a particular type into an object of a different type.
|
static Set<ConverterFactory> |
getConverterFactories(Class<?> source,
Class<?> target)
Returns a set of all available
ConverterFactory 's which can handle convert from the
source to destination class. |
static Set<ConverterFactory> |
getConverterFactories(Hints hints)
Returns a set of all available implementations for the
ConverterFactory interface. |
public static Set<ConverterFactory> getConverterFactories(Hints hints)
ConverterFactory
interface.hints
- An optional map of hints, or null
if none.public static Set<ConverterFactory> getConverterFactories(Class<?> source, Class<?> target)
ConverterFactory
's which can handle convert from the
source to destination class.
This method essentially returns all factories in which the following returns non null.
factory.createConverter( source, target );
public static <T> T convert(Object source, Class<T> target)
Convenience for convert(Object, Class, Hints)
source
- The object to convert.target
- The type of the converted value.null
if a converter
could not be foundpublic static <T> T convert(Object source, Class<T> target, Hints hints)
This method uses the ConverterFactory
extension point to find a converter capable
of performing the conversion. The first converter found is the one used. Using this class
there is no way to guarantee which converter will be used.
source
- The object to convert.target
- The type of the converted value.hints
- Any hints for the converter factory.null
if a converter
could not be found.Copyright © 1996–2019 Geotools. All rights reserved.