Package org.exolab.castor.mapping.loader
Class TypeInfo<T>
java.lang.Object
org.exolab.castor.mapping.loader.TypeInfo<T>
Type information passed on creation of a
FieldHandlerImpl
.- Version:
- $Revision: 9062 $ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
- Author:
- Assaf Arkin
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct new type information for a field.TypeInfo
(Class<T> fieldType, TypeConvertor convertorTo, TypeConvertor convertorFrom, boolean required, Object defaultValue, CollectionHandler<T> colHandler) Construct new type information for the field.TypeInfo
(Class<T> fieldType, TypeConvertor convertorTo, TypeConvertor convertorFrom, boolean required, Object defaultValue, CollectionHandler<T> colHandler, boolean checkForCollection) Construct new type information for the field. -
Method Summary
Modifier and TypeMethodDescriptionReturn the collection handler of this field.Returns the convertor from the field type to an external type.Returns the convertor to the field type from an external type.Returns the default value for the field.Class<?>
Returns the field type.boolean
Returns true if field type is immutable.boolean
Returns true if field type is required.void
setCollectionHandler
(CollectionHandler<T> handler) Sets the CollectionHandler to use for the field described by this TypeInfo.void
setRequired
(boolean required) Sets a flag indictating if the field is required.
-
Constructor Details
-
TypeInfo
Construct new type information for a field. This field requires no type conversion, and has no default value.- Parameters:
fieldType
- The field type
-
TypeInfo
public TypeInfo(Class<T> fieldType, TypeConvertor convertorTo, TypeConvertor convertorFrom, boolean required, Object defaultValue, CollectionHandler<T> colHandler) Construct new type information for the field.- Parameters:
fieldType
- The field typeconvertorTo
- Convertor to the field type from external type, or null if no conversion is requiredconvertorFrom
- Convertor from the field type to external type, or null if no conversion is requiredrequired
- True if the field is requireddefaultValue
- The default value of the field, null to use the known Java defaultscolHandler
- The collection handler for this field, or null if field is singular
-
TypeInfo
public TypeInfo(Class<T> fieldType, TypeConvertor convertorTo, TypeConvertor convertorFrom, boolean required, Object defaultValue, CollectionHandler<T> colHandler, boolean checkForCollection) Construct new type information for the field.- Parameters:
fieldType
- The field typeconvertorTo
- Convertor to the field type from external type, or null if no conversion is requiredconvertorFrom
- Convertor from the field type to external type, or null if no conversion is requiredrequired
- True if the field is requireddefaultValue
- The default value of the field, null to use the known Java defaultscolHandler
- The collection handler for this field, or null if field is singular
-
-
Method Details
-
getFieldType
Returns the field type.- Returns:
- The field type
-
getConvertorTo
Returns the convertor to the field type from an external type.- Returns:
- Convertor to field type
-
getConvertorFrom
Returns the convertor from the field type to an external type.- Returns:
- Convertor from field type
-
isImmutable
public boolean isImmutable()Returns true if field type is immutable.- Returns:
- True if type is immutable
-
isRequired
public boolean isRequired()Returns true if field type is required.- Returns:
- True if field is required
-
getDefaultValue
Returns the default value for the field.- Returns:
- The default value
-
getCollectionHandler
Return the collection handler of this field.- Returns:
- The collection handler of this field
-
setRequired
public void setRequired(boolean required) Sets a flag indictating if the field is required.- Parameters:
required
- the value of the flag. Should be true if the field is required, false otherwise.
-
setCollectionHandler
Sets the CollectionHandler to use for the field described by this TypeInfo.- Parameters:
handler
- the CollectionHandler, or null if no CollectionHandler should be used.
-