Package org.mvel2.conversion
Class ArrayHandler
- java.lang.Object
-
- org.mvel2.conversion.ArrayHandler
-
- All Implemented Interfaces:
ConversionHandler
public class ArrayHandler extends java.lang.Object implements ConversionHandler
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class
type
-
Constructor Summary
Constructors Constructor Description ArrayHandler(java.lang.Class type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canConvertFrom(java.lang.Class cls)
This method is used to indicate to the runtime whehter or not the handler knows how to convert from the specified type.java.lang.Object
convertFrom(java.lang.Object in)
Converts the passed argument to the type represented by the handler.private static java.lang.Object
handleLooseTypeConversion(java.lang.Class sourceType, java.lang.Object input, java.lang.Class targetType)
Messy method to handle primitive boxing for conversion.
-
-
-
Method Detail
-
convertFrom
public java.lang.Object convertFrom(java.lang.Object in)
Description copied from interface:ConversionHandler
Converts the passed argument to the type represented by the handler.- Specified by:
convertFrom
in interfaceConversionHandler
- Parameters:
in
- - the input type- Returns:
- - the converted type
-
canConvertFrom
public boolean canConvertFrom(java.lang.Class cls)
Description copied from interface:ConversionHandler
This method is used to indicate to the runtime whehter or not the handler knows how to convert from the specified type.- Specified by:
canConvertFrom
in interfaceConversionHandler
- Parameters:
cls
- - the source type- Returns:
- - true if the converter supports converting from the specified type.
-
handleLooseTypeConversion
private static java.lang.Object handleLooseTypeConversion(java.lang.Class sourceType, java.lang.Object input, java.lang.Class targetType)
Messy method to handle primitive boxing for conversion. If someone can re-write this more elegantly, be my guest.- Parameters:
sourceType
-input
-targetType
-- Returns:
-
-