net.aavalla.utils.jobpool.parameters
Interface FieldTypeHandler

All Known Implementing Classes:
DefaultFieldTypeHandler

public interface FieldTypeHandler

Handles an assortment of field types.

Author:
Lari Natri

Method Summary
 java.lang.Object convertType(java.lang.Object value, java.lang.Class valueType, java.lang.Class returnType)
          Should cast the parameter to type T.
 java.lang.Class getAsSupportedType(java.lang.Class rawType)
          This function should convert a given type to a compatible type that is supported by this FieldTypeHandler.
 ValueComponent getValueComponentFor(java.lang.Class supportedType, FieldInstance f, boolean allowEdit)
          This function should return a new object derived from ValueComponent, which can handle fields of the type given as parameter.
 

Method Detail

getAsSupportedType

java.lang.Class getAsSupportedType(java.lang.Class rawType)
This function should convert a given type to a compatible type that is supported by this FieldTypeHandler. If this handler doesn't support the given type, null value should be returned.

Parameters:
rawType - type to convert to a supported type (if any)
Returns:
supported type or null if not supported

convertType

java.lang.Object convertType(java.lang.Object value,
                             java.lang.Class valueType,
                             java.lang.Class returnType)
Should cast the parameter to type T. This conversion is possible, because it has already passed getAsSupportedType

Type Parameters:
T -
Parameters:
value -
Returns:

getValueComponentFor

ValueComponent getValueComponentFor(java.lang.Class supportedType,
                                    FieldInstance f,
                                    boolean allowEdit)
This function should return a new object derived from ValueComponent, which can handle fields of the type given as parameter.

Type Parameters:
T -
Parameters:
supportedType - some type this handler supports
allowEdit - whether ValueComponent should allow editing of the field
Returns:
an object derived from ValueComponent