net.aavalla.utils.jobpool.parameters
Class DefaultFieldTypeHandler

java.lang.Object
  extended by net.aavalla.utils.jobpool.parameters.DefaultFieldTypeHandler
All Implemented Interfaces:
FieldTypeHandler

public class DefaultFieldTypeHandler
extends java.lang.Object
implements FieldTypeHandler

Author:
Lari Natri

Constructor Summary
DefaultFieldTypeHandler()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFieldTypeHandler

public DefaultFieldTypeHandler()
Method Detail

getAsSupportedType

public java.lang.Class getAsSupportedType(java.lang.Class rawType)
Description copied from interface: FieldTypeHandler
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.

Specified by:
getAsSupportedType in interface FieldTypeHandler
Parameters:
rawType - type to convert to a supported type (if any)
Returns:
supported type or null if not supported

convertType

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

Specified by:
convertType in interface FieldTypeHandler
Returns:

getValueComponentFor

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

Specified by:
getValueComponentFor in interface FieldTypeHandler
Parameters:
supportedType - some type this handler supports
allowEdit - whether ValueComponent should allow editing of the field
Returns:
an object derived from ValueComponent