Interface TypeConversionHandler
-
- All Known Implementing Classes:
TypeConversionHandlerImpl
public interface TypeConversionHandlerA conversion handler adds admissible conversions between Java types whenever Velocity introspection has to map VTL methods and property accessors to Java methods. Both methods must be consistent:getNeededConvertermust not returnnullwheneverisExplicitlyConvertiblereturned true with the same arguments.- Since:
- 2.1
- Version:
- $Id: ConversionHandler.java $
- Author:
- Claude Brisson
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddConverter(java.lang.reflect.Type formal, java.lang.Class<?> actual, Converter<?> converter)Add the given converter to the handler.Converter<?>getNeededConverter(java.lang.reflect.Type formal, java.lang.Class<?> actual)Returns the appropriate Converter object needed for an explicit conversion Returns null if no conversion is needed.booleanisExplicitlyConvertible(java.lang.reflect.Type formal, java.lang.Class<?> actual, boolean possibleVarArg)Check to see if the conversion can be done using an explicit conversion
-
-
-
Method Detail
-
isExplicitlyConvertible
boolean isExplicitlyConvertible(java.lang.reflect.Type formal, java.lang.Class<?> actual, boolean possibleVarArg)Check to see if the conversion can be done using an explicit conversion- Parameters:
formal- expected formal typeactual- provided argument typepossibleVarArg- whether var arg is possible- Returns:
- null if no conversion is needed, or the appropriate Converter object
- Since:
- 2.1
-
getNeededConverter
Converter<?> getNeededConverter(java.lang.reflect.Type formal, java.lang.Class<?> actual)
Returns the appropriate Converter object needed for an explicit conversion Returns null if no conversion is needed.- Parameters:
formal- expected formal typeactual- provided argument type- Returns:
- null if no conversion is needed, or the appropriate Converter object
- Since:
- 2.1
-
addConverter
void addConverter(java.lang.reflect.Type formal, java.lang.Class<?> actual, Converter<?> converter)Add the given converter to the handler. Implementation should be thread-safe.- Parameters:
formal- expected formal typeactual- provided argument typeconverter- converter- Since:
- 2.1
-
-