public class DefaultConverter extends java.lang.Object implements ArooaConverter
ArooaConverter
. This converter uses
a ConversionLookup
to provide the
ConversionPath
for the conversion. If none
is provided the DefaultConversionLookup
is used.Constructor and Description |
---|
DefaultConverter() |
DefaultConverter(ConversionLookup convertlets)
Only Constructor.
|
Modifier and Type | Method and Description |
---|---|
<F,T> T |
convert(F from,
java.lang.Class<T> required)
Perform a conversion.
|
<F,T> ConversionPath<F,T> |
findConversion(java.lang.Class<F> fromClass,
java.lang.Class<T> required)
Find a conversion in the convertletRegistry.
|
ConversionLookup |
getRegistry() |
public DefaultConverter(ConversionLookup convertlets)
convertlets
- A ConvertletRegistry.public DefaultConverter()
public ConversionLookup getRegistry()
public <F,T> T convert(F from, java.lang.Class<T> required) throws NoConversionAvailableException, ConversionFailedException
ArooaValue
and it's not already
the required ArooaValue then perform a conversion using the best conversion
found from the provided ArooaConversionKit
. convert
in interface ArooaConverter
ArooaConverter.convert(java.lang.Object, java.lang.Class)
from
- The Object to convert. May be null.required
- The Class the object is to converted into.NoConversionAvailableException
- If ther is no conversion to
the required type.ConversionFailedException
- If applying the conversion failed.public <F,T> ConversionPath<F,T> findConversion(java.lang.Class<F> fromClass, java.lang.Class<T> required)
findConversion
in interface ConversionLookup
fromClass
- Class to convert from.required
- Class to convert to.NoConversionAvailableException
- If no conversion is available.