Package org.exolab.castor.persist
Class FieldMolder
java.lang.Object
org.exolab.castor.persist.FieldMolder
FieldMolder represents a field of a data object class. It is used by
ClassMolder to set and get the value from a field of a data object.
- Author:
- Thomas Yip
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFieldMolder
(DatingService datingService, ClassMolder enclosingClassMolder, FieldDescriptor fieldDescriptor) FieldMolder
(DatingService ds, ClassMolder eMold, FieldDescriptor fieldDescriptor, SQLRelationLoader loader) Creates a single field descriptor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addValue
(Object object, Object value, ClassLoader loader) static final Method
findAccessor
(Class<?> javaClass, String methodName, Class<?> fieldType, boolean getMethod) Returns the named accessor.Returns the 'cascading operations' defined for this field.Class
<?> protected Class
<?> getCollectionType
(String coll, boolean lazy) Returns the java.util.Comparator instance to be used with SortedSets; null, if not specified.getName()
getValue
(Object object, ClassLoader loader) boolean
boolean
boolean
Check if the specified value is the default value of the Field represented by this FieldMolder.boolean
boolean
isLazy()
boolean
boolean
isMulti()
boolean
boolean
boolean
boolean
isStored()
boolean
(package private) void
setFieldClassMolder
(ClassMolder fMold) void
setValue
(Object object, Object value, ClassLoader loader) toString()
-
Constructor Details
-
FieldMolder
public FieldMolder(DatingService ds, ClassMolder eMold, FieldDescriptor fieldDescriptor, SQLRelationLoader loader) throws MappingException Creates a single field descriptor. The field mapping is used to create a new stockFieldMolder
. Implementations may extend this class to create a more suitable descriptor.- Parameters:
eMold
- The ClassMolder to which the field belongsfieldMapping
- The field mapping information- Throws:
MappingException
- The field or its accessor methods are not found, not accessible, not of the specified type, etc
-
FieldMolder
public FieldMolder(DatingService datingService, ClassMolder enclosingClassMolder, FieldDescriptor fieldDescriptor) throws MappingException - Throws:
MappingException
-
-
Method Details
-
toString
-
getName
-
getComparator
Returns the java.util.Comparator instance to be used with SortedSets; null, if not specified.- Returns:
- the java.util.Comparator instance to be used with SortedSets
-
getFieldPertsistenceType
-
getRelationLoader
-
isStored
public boolean isStored() -
isManyToMany
public boolean isManyToMany() -
isDependent
public boolean isDependent() -
isMulti
public boolean isMulti() -
isPersistanceCapable
public boolean isPersistanceCapable() -
isSerializable
public boolean isSerializable() -
isCheckDirty
public boolean isCheckDirty() -
isLazy
public boolean isLazy() -
isAddable
public boolean isAddable() -
isTransient
public boolean isTransient() -
setFieldClassMolder
-
getEnclosingClassMolder
-
getFieldClassMolder
-
getFieldLockEngine
-
isReadonly
public boolean isReadonly() -
getCollectionType
-
getCascading
Returns the 'cascading operations' defined for this field.- Returns:
- the 'cascading operations' defined.
-
getValue
-
addValue
-
setValue
-
isDefault
Check if the specified value is the default value of the Field represented by this FieldMolder. -
getCollectionType
-
findAccessor
public static final Method findAccessor(Class<?> javaClass, String methodName, Class<?> fieldType, boolean getMethod) throws MappingException Returns the named accessor. Uses reflection to return the named accessor and check the return value or parameter type, if specified.- Parameters:
javaClass
- The class to which the field belongs.methodName
- The name of the accessor method.fieldType
- The type of the field if known, or null.getMethod
- True if get method, false if set method.- Returns:
- The method, null if not found.
- Throws:
MappingException
- The method is not accessible or is not of the specified type.
-