| Constructor and Description |
|---|
Converters(java.util.List<java.lang.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(java.lang.Class<? extends Converter> converterClass) |
java.lang.Object |
convert(java.lang.Object value,
java.lang.reflect.Type targetType)
Converts the supplied object to the supplied target type.
|
Converter |
getConverter(java.lang.Object value,
java.lang.reflect.Type targetType)
Returns a suitable converter for supplied parameters or null if no converter
can be found.
|
Converter |
getConverter(java.lang.Object value,
java.lang.reflect.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.
|
java.lang.Object |
revert(java.lang.Object value)
Revert back to standard (AMF3 known Java type) the supplied value.
|
public Converters(java.util.List<java.lang.Class<? extends Converter>> converterClasses) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException
converterClasses - the list of all used converters.java.lang.NoSuchMethodException - if one of the Converter does not have a constructor with a
Converters parameter.java.lang.IllegalAccessException - if something goes wrong when creating an instance of one
of the supplied Converter classes.java.lang.reflect.InvocationTargetException - if something goes wrong when creating an instance of one
of the supplied Converter classes.java.lang.InstantiationException - if something goes wrong when creating an instance of one
of the supplied Converter classes.public void addConverter(java.lang.Class<? extends Converter> converterClass) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException
java.lang.NoSuchMethodExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.InstantiationExceptionpublic Converter getConverter(java.lang.Object value, java.lang.reflect.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(java.lang.Object value, java.lang.reflect.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 java.lang.Object convert(java.lang.Object value,
java.lang.reflect.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 java.lang.Object revert(java.lang.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()