public class Converters extends Object
| Constructor and Description |
|---|
Converters(List<Class<? extends Converter>> converterClasses)
Constructs a new Converters instance with the supplied list of converters (possibly reverters).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConverter(Class<? extends Converter> converterClass) |
Object |
convert(Object value,
Type targetType)
Converts the supplied object to the supplied target type.
|
Converter |
getConverter(Object value,
Type targetType)
Returns a suitable converter for supplied parameters or null if no converter
can be found.
|
Converter |
getConverter(Object value,
Type targetType,
boolean throwNotFoundException)
Returns a suitable converter for supplied parameters or either returns null if no converter
can be found or throws a
NoConverterFoundException. |
Converter[] |
getConverters() |
boolean |
hasReverters()
Returns true if at least one reverter is configured for this Converters instance.
|
Object |
revert(Object value)
Revert back to standard, AMF3 known Java type the supplied value.
|
public Converters(List<Class<? extends Converter>> converterClasses) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
converterClasses - the list of all used converters.NoSuchMethodException - if one of the Converter does not have a constructor with a
Converters parameter.IllegalAccessException - if something goes wrong when creating an instance of one
of the supplied Converter classes.InvocationTargetException - if something goes wrong when creating an instance of one
of the supplied Converter classes.InstantiationException - if something goes wrong when creating an instance of one
of the supplied Converter classes.public void addConverter(Class<? extends Converter> converterClass) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
public Converter getConverter(Object value, Type targetType)
getConverter(Object, Type, boolean) method with the
throwNotFoundException parameter set to false.value - the value to be convertedtargetType - the type of the converted valuepublic Converter getConverter(Object value, Type targetType, boolean throwNotFoundException) throws NoConverterFoundException
NoConverterFoundException.value - the value to be convertedtargetType - the type of the converted valuethrowNotFoundException - should an exception be thrown if no converter is found?NoConverterFoundException - if the throwNotFoundException parameter is set to true
and no converter can be found.public Object convert(Object value, Type targetType) throws NoConverterFoundException
value - the object to be converted.targetType - the target type.NoConverterFoundException - if no suitable converter can be found.public boolean hasReverters()
public Object revert(Object value)
Reverter.revert(Object) method result
if the Reverter.canRevert(Object) method returns true for the current Reverter
instance.value - the value to be reverted.public Converter[] getConverters()