|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectConverters
public final class Converters
Convenience class for converting an object from one type to an object of another.
Constructor Summary | |
---|---|
Converters()
|
Method Summary | ||
---|---|---|
static
|
convert(Object source,
Class<T> target)
Converts an object of a particular type into an object of a different type. |
|
static
|
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. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Converters()
Method Detail |
---|
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |