public class AggregateConverter extends Object implements Converter
registerConverter(Converter)
and unregistered using unregisterConverter(Converter)
.
Each BlueprintContainer
has its own AggregateConverter
used to register converters defined by the related blueprint bundle.Modifier and Type | Class and Description |
---|---|
static interface |
AggregateConverter.Convertible
Objects implementing this interface will bypass the default conversion rules
and be called directly to transform into the expected type.
|
Constructor and Description |
---|
AggregateConverter(ExtendedBlueprintContainer blueprintContainer) |
Modifier and Type | Method and Description |
---|---|
boolean |
canConvert(Object fromValue,
ReifiedType toType)
Return if this converter is able to convert the specified object to the
specified type.
|
Object |
convert(Object fromValue,
ReifiedType type)
Convert the specified object to an instance of the specified type.
|
Object |
convert(Object source,
Type target) |
Object |
convertFromString(String value,
Class toType,
Object loader) |
Object |
convertToNumber(Number value,
Class toType) |
static boolean |
isAssignable(Object source,
ReifiedType target) |
void |
registerConverter(Converter converter) |
void |
unregisterConverter(Converter converter) |
public AggregateConverter(ExtendedBlueprintContainer blueprintContainer)
public void registerConverter(Converter converter)
public void unregisterConverter(Converter converter)
public boolean canConvert(Object fromValue, ReifiedType toType)
Converter
canConvert
in interface Converter
fromValue
- The source object s
to convert.toType
- The target type T
.true
if the conversion is possible,
false
otherwise.public Object convert(Object fromValue, ReifiedType type) throws Exception
Converter
convert
in interface Converter
fromValue
- The source object s
to convert.type
- The target type T
.Exception
- If the conversion cannot succeed. This exception should
not be thrown when the canConvert
method has
returned true
.public Object convertToNumber(Number value, Class toType) throws Exception
Exception
public Object convertFromString(String value, Class toType, Object loader) throws Exception
Exception
public static boolean isAssignable(Object source, ReifiedType target)
Copyright © 2012. All Rights Reserved.