com.ivata.mask.field
Class DefaultFieldValueConvertorFactory

java.lang.Object
  extended bycom.ivata.mask.field.DefaultFieldValueConvertorFactory
All Implemented Interfaces:
FieldValueConvertorFactory, java.io.Serializable

public class DefaultFieldValueConvertorFactory
extends java.lang.Object
implements FieldValueConvertorFactory, java.io.Serializable

Since:
ivata groupware 0.11 (17-Mar-2005)
Version:
$Revision: 1.1 $
Author:
Colin MacLeod colin.macleod@ivata.com
See Also:
Serialized Form

Constructor Summary
DefaultFieldValueConvertorFactory()
          Constructor.
 
Method Summary
static java.lang.Class convertPrimitiveType(java.lang.Class type)
          Convert a primitive type (such as int, char) to the wrapper class associated with it (such as Integer, Character).
 FieldValueConvertor getFieldValueConvertorForClass(java.lang.Class fieldValueClass)
           Find the appropriate convertor for the field value class provided.
protected  FieldValueConvertor getFieldValueConvertorForClass(java.lang.Class originalClass, java.lang.Class fieldValueClassParam)
           Find the appropriate convertor for the field value class provided.
 void setFieldValueConvertor(java.lang.Class fieldClass, FieldValueConvertor convertor)
           Set the field value convertor to use for a particular class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFieldValueConvertorFactory

public DefaultFieldValueConvertorFactory()
Constructor.

Method Detail

convertPrimitiveType

public static java.lang.Class convertPrimitiveType(java.lang.Class type)
                                            throws com.ivata.mask.util.SystemException
Convert a primitive type (such as int, char) to the wrapper class associated with it (such as Integer, Character).

Parameters:
type - The type to be converted.
Returns:
Wrapper class for the type provided.
Throws:
javax.servlet.ServletException - if an unknown type is encountered.
com.ivata.mask.util.SystemException

getFieldValueConvertorForClass

public FieldValueConvertor getFieldValueConvertorForClass(java.lang.Class fieldValueClass)
                                                   throws com.ivata.mask.util.SystemException

Find the appropriate convertor for the field value class provided. This method goes thro' all the parent classes of the class provided till it finds a suitable convertor.

Specified by:
getFieldValueConvertorForClass in interface FieldValueConvertorFactory
Parameters:
fieldValueClass - Class of the field value we are tryinh to convert from a string.
Returns:
value field value convertor.
Throws:
com.ivata.mask.util.SystemException - thrown if there is a class in the hierarchy for which we have no field value convertor.

getFieldValueConvertorForClass

protected FieldValueConvertor getFieldValueConvertorForClass(java.lang.Class originalClass,
                                                             java.lang.Class fieldValueClassParam)
                                                      throws com.ivata.mask.util.SystemException

Find the appropriate convertor for the field value class provided. This method goes thro' all the parents till it finds a suitable convertor.

Parameters:
originalClass - original class we searched for (used in error reporting).
Returns:
value field value convertor.
Throws:
javax.servlet.ServletException - thrown if there is a class in the hierarchy for which we have no field value convertor.
com.ivata.mask.util.SystemException

setFieldValueConvertor

public void setFieldValueConvertor(java.lang.Class fieldClass,
                                   FieldValueConvertor convertor)

Set the field value convertor to use for a particular class.

Specified by:
setFieldValueConvertor in interface FieldValueConvertorFactory
Parameters:
fieldClass - class to be converted.
convertor - convertor to use for this class.


Copyright © 2001-2005 ivata limited. All Rights Reserved.