org.exolab.castor.persist
Class FieldMolder

java.lang.Object
  extended by org.exolab.castor.persist.FieldMolder

public class FieldMolder
extends java.lang.Object

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

Field Summary
static short MANY_TO_MANY
           
static short ONE_TO_MANY
           
static short PERSISTANCECAPABLE
           
static short PRIMITIVE
           
static short SERIALIZABLE
           
 
Constructor Summary
FieldMolder(DatingService ds, ClassMolder eMold, org.exolab.castor.mapping.xml.FieldMapping fieldMap)
           
FieldMolder(DatingService ds, ClassMolder eMold, org.exolab.castor.mapping.xml.FieldMapping fieldMap, java.lang.String manyTable, java.lang.String[] idSQL, int[] idType, TypeConvertor[] idTo, TypeConvertor[] idFrom, java.lang.String[] relatedIdSQL, int[] relatedIdType, TypeConvertor[] ridTo, TypeConvertor[] ridFrom)
          Creates a single field descriptor.
 
Method Summary
 void addValue(java.lang.Object object, java.lang.Object value, java.lang.ClassLoader loader)
           
static java.lang.reflect.Method findAccessor(java.lang.Class javaClass, java.lang.String methodName, java.lang.Class fieldType, boolean getMethod)
          Returns the named accessor.
 java.lang.Class getCollectionType()
           
protected  java.lang.Class getCollectionType(java.lang.String coll, boolean lazy)
           
 java.lang.String getComparator()
          Returns the java.util.Comparator instance to be used with SortedSets; null, if not specified.
 ClassMolder getEnclosingClassMolder()
           
 ClassMolder getFieldClassMolder()
           
 LockEngine getFieldLockEngine()
           
 short getFieldType()
           
 java.lang.String getName()
           
 SQLRelationLoader getRelationLoader()
           
 java.lang.Object getValue(java.lang.Object object, java.lang.ClassLoader loader)
           
 boolean isAddable()
           
 boolean isCheckDirty()
           
 boolean isDefault(java.lang.Object value)
          Check if the specified value is the default value of the Field represented by this FieldMolder.
 boolean isDependent()
           
 boolean isLazy()
           
 boolean isManyToMany()
           
 boolean isMulti()
           
 boolean isPersistanceCapable()
           
 boolean isReadonly()
           
 boolean isSerializable()
           
 boolean isStored()
           
 boolean isTransient()
           
 void setValue(java.lang.Object object, java.lang.Object value, java.lang.ClassLoader loader)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PRIMITIVE

public static final short PRIMITIVE
See Also:
Constant Field Values

SERIALIZABLE

public static final short SERIALIZABLE
See Also:
Constant Field Values

PERSISTANCECAPABLE

public static final short PERSISTANCECAPABLE
See Also:
Constant Field Values

ONE_TO_MANY

public static final short ONE_TO_MANY
See Also:
Constant Field Values

MANY_TO_MANY

public static final short MANY_TO_MANY
See Also:
Constant Field Values
Constructor Detail

FieldMolder

public FieldMolder(DatingService ds,
                   ClassMolder eMold,
                   org.exolab.castor.mapping.xml.FieldMapping fieldMap,
                   java.lang.String manyTable,
                   java.lang.String[] idSQL,
                   int[] idType,
                   TypeConvertor[] idTo,
                   TypeConvertor[] idFrom,
                   java.lang.String[] relatedIdSQL,
                   int[] relatedIdType,
                   TypeConvertor[] ridTo,
                   TypeConvertor[] ridFrom)
            throws MappingException
Creates a single field descriptor. The field mapping is used to create a new stock FieldMolder. Implementations may extend this class to create a more suitable descriptor.

Parameters:
eMold - The ClassMolder to which the field belongs
fieldMap - 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 ds,
                   ClassMolder eMold,
                   org.exolab.castor.mapping.xml.FieldMapping fieldMap)
            throws MappingException
Throws:
MappingException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()

getComparator

public java.lang.String 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

getFieldType

public short getFieldType()

getRelationLoader

public SQLRelationLoader 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()

getEnclosingClassMolder

public ClassMolder getEnclosingClassMolder()

getFieldClassMolder

public ClassMolder getFieldClassMolder()

getFieldLockEngine

public LockEngine getFieldLockEngine()

isReadonly

public boolean isReadonly()

getCollectionType

public java.lang.Class getCollectionType()

getValue

public java.lang.Object getValue(java.lang.Object object,
                                 java.lang.ClassLoader loader)

addValue

public void addValue(java.lang.Object object,
                     java.lang.Object value,
                     java.lang.ClassLoader loader)

setValue

public void setValue(java.lang.Object object,
                     java.lang.Object value,
                     java.lang.ClassLoader loader)

isDefault

public boolean isDefault(java.lang.Object value)
Check if the specified value is the default value of the Field represented by this FieldMolder.


getCollectionType

protected java.lang.Class getCollectionType(java.lang.String coll,
                                            boolean lazy)

findAccessor

public static final java.lang.reflect.Method findAccessor(java.lang.Class javaClass,
                                                          java.lang.String methodName,
                                                          java.lang.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.


Copyright © 2011. All Rights Reserved.