| java.lang.Object org.exolab.castor.mapping.loader.AbstractMappingLoader2 org.exolab.castor.mapping.loader.AbstractMappingLoader
All known Subclasses: org.exolab.castor.xml.XMLMappingLoader,
AbstractMappingLoader | abstract public class AbstractMappingLoader extends AbstractMappingLoader2 (Code) | | Assists in the construction of descriptors. Can be used as a mapping
resolver to the engine. Engines will implement their own mapping
scheme typically by extending this class.
author: Assaf Arkin author: Keith Visco version: $Revision: 6784 $ $Date: 2006-04-10 16:39:24 -0600 (Mon, 10 Apr 2006) $ |
Inner Class :public class TypeInfoReference | |
Field Summary | |
final protected static Class[] | EMPTY_ARGS Empty array of class types used for reflection. | final protected static Class[] | STRING_ARG The string argument for the valueOf method, used for introspection when searching for
type-safe enumeration style classes. | final protected static String | VALUE_OF Factory method name for type-safe enumerations. |
Method Summary | |
final protected void | checkFieldNameDuplicates(FieldDescriptor[] fields, Class cls) Checks all given fields for name equality and throws a MappingException if at
least two fields have the same name. | abstract protected ClassDescriptor | createClassDescriptor(ClassMapping clsMap) | final protected void | createClassDescriptors(MappingRoot mapping) | protected AbstractFieldDescriptor | createFieldDesc(Class javaClass, FieldMapping fieldMap) Creates a single field descriptor. | final protected AbstractFieldDescriptor[] | createFieldDescriptors(ClassMapping clsMap, Class javaClass) Create field descriptors. | final protected FieldHandler | createFieldHandler(Class javaClass, Class fldType, FieldMapping fldMap, TypeInfoReference typeInfoRef) Creates the FieldHandler for the given FieldMapping.
Parameters: javaClass - the class type of the parent of the field. Parameters: fldType - the Java class type for the field. Parameters: fldMap - the field mapping. | final protected FieldDescriptor[] | divideFieldDescriptors(FieldDescriptor[] fields, String[] ids, FieldDescriptor[] identities) | final public static Method | findAccessor(Class javaClass, String methodName, Class fieldType, boolean getMethod) Returns the named accessor. | final protected ClassDescriptor | getDepended(ClassMapping clsMap, Class javaClass) Gets the ClassDescriptor the given classMapping depends
on.
Parameters: clsMap - The ClassMapping to find the required ClassDescriptor for. Parameters: javaClass - The name of the class that is checked (this is used forgenerating the exception). | final protected ClassDescriptor | getExtended(ClassMapping clsMap, Class javaClass) Gets the ClassDescriptor the given classMapping extends.
Parameters: clsMap - The ClassMapping to find the required descriptor for. Parameters: javaClass - The name of the class that is checked (this is used forgenerating the exception). | protected int | getIdColumnIndex(FieldDescriptor field, String[] ids) Finds the index in the given idColumnNames that has the same name as
the given field .
Parameters: field - The FieldDescriptor to find the column index for. Parameters: ids - The id columnNames available. | final public static String[] | getIdentityColumnNames(String[] ids, ClassMapping clsMap) Returns a list of column names that are part of the identity.
Parameters: ids - Known identity names. Parameters: clsMap - Class mapping. | final protected ClassMapping | getOrigin(ClassMapping clsMap) Gets the top-most (i.e. | final public String | getSourceType() | protected TypeInfo | getTypeInfo(Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap) | final protected static boolean | isPrimitive(Class type) | abstract public void | loadMapping(MappingRoot mapping, Object param) Loads the mapping from the specified mapping object if not loaded previously. | abstract protected void | resolveRelations(ClassDescriptor clsDesc) | final protected Class | resolveType(String typeName) Returns the Java class for the named type. |
EMPTY_ARGS | final protected static Class[] EMPTY_ARGS(Code) | | Empty array of class types used for reflection.
|
STRING_ARG | final protected static Class[] STRING_ARG(Code) | | The string argument for the valueOf method, used for introspection when searching for
type-safe enumeration style classes.
|
VALUE_OF | final protected static String VALUE_OF(Code) | | Factory method name for type-safe enumerations.
|
AbstractMappingLoader | protected AbstractMappingLoader(ClassLoader loader)(Code) | | Constructs a new mapping helper. This constructor is used by a derived class.
Parameters: loader - The class loader to use, null for the default |
checkFieldNameDuplicates | final protected void checkFieldNameDuplicates(FieldDescriptor[] fields, Class cls) throws MappingException(Code) | | Checks all given fields for name equality and throws a MappingException if at
least two fields have the same name.
Parameters: fields - The fields to be checked. Parameters: cls - Class that is checked (this is used for generating the exception). throws: MappingException - If at least two fields have the same name. |
createFieldDesc | protected AbstractFieldDescriptor createFieldDesc(Class javaClass, FieldMapping fieldMap) throws MappingException(Code) | | Creates a single field descriptor. The field mapping is used to create a new stock
FieldDescriptor . Implementations may extend this class to create a more
suitable descriptor.
Parameters: javaClass - The class to which the field belongs. Parameters: fieldMap - The field mapping information. The field descriptor. throws: MappingException - The field or its accessor methods are notfound, not accessible, not of the specified type, etc. |
createFieldDescriptors | final protected AbstractFieldDescriptor[] createFieldDescriptors(ClassMapping clsMap, Class javaClass) throws MappingException(Code) | | Create field descriptors. The class mapping information is used to create
descriptors for all the fields in the class, except for container fields.
Implementations may extend this method to create more suitable descriptors, or
create descriptors only for a subset of the fields.
Parameters: clsMap - The class to which the fields belong. Parameters: javaClass - The field mappings. throws: MappingException - An exception indicating why mapping for the class cannotbe created. |
createFieldHandler | final protected FieldHandler createFieldHandler(Class javaClass, Class fldType, FieldMapping fldMap, TypeInfoReference typeInfoRef) throws MappingException(Code) | | Creates the FieldHandler for the given FieldMapping.
Parameters: javaClass - the class type of the parent of the field. Parameters: fldType - the Java class type for the field. Parameters: fldMap - the field mapping. the newly created FieldHandler. |
findAccessor | final public static Method findAccessor(Class javaClass, String methodName, Class fieldType, boolean getMethod) throws MappingException(Code) | | 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. Parameters: methodName - The name of the accessor method. Parameters: fieldType - The type of the field if known, or null. Parameters: getMethod - True if get method, false if set method. The method, null if not found. throws: MappingException - The method is not accessible or is not of thespecified type. |
getDepended | final protected ClassDescriptor getDepended(ClassMapping clsMap, Class javaClass) throws MappingException(Code) | | Gets the ClassDescriptor the given classMapping depends
on.
Parameters: clsMap - The ClassMapping to find the required ClassDescriptor for. Parameters: javaClass - The name of the class that is checked (this is used forgenerating the exception). The ClassDescriptor the given ClassMapping depends on ornull if the given ClassMapping does not depend onany. throws: MappingException - If the given ClassMapping depends on anotherClassMapping but its descriptor could not be found. |
getExtended | final protected ClassDescriptor getExtended(ClassMapping clsMap, Class javaClass) throws MappingException(Code) | | Gets the ClassDescriptor the given classMapping extends.
Parameters: clsMap - The ClassMapping to find the required descriptor for. Parameters: javaClass - The name of the class that is checked (this is used forgenerating the exception). The ClassDescriptor the given ClassMapping extends ornull if the given ClassMapping does not extendany. throws: MappingException - If the given ClassMapping extends anotherClassMapping but its descriptor could not be found. |
getIdColumnIndex | protected int getIdColumnIndex(FieldDescriptor field, String[] ids)(Code) | | Finds the index in the given idColumnNames that has the same name as
the given field .
Parameters: field - The FieldDescriptor to find the column index for. Parameters: ids - The id columnNames available. The index of the id column name that matches the given field's name or-1 if no such id column name exists. |
getIdentityColumnNames | final public static String[] getIdentityColumnNames(String[] ids, ClassMapping clsMap)(Code) | | Returns a list of column names that are part of the identity.
Parameters: ids - Known identity names. Parameters: clsMap - Class mapping. List of identity column names. |
getOrigin | final protected ClassMapping getOrigin(ClassMapping clsMap)(Code) | | Gets the top-most (i.e. without any further 'extends') extends of the given
classMapping .
Parameters: clsMap - The ClassMapping to get the origin for. The top-most extends of the given ClassMapping or the ClassMapping itselfif it does not extend any other ClassMapping. |
isPrimitive | final protected static boolean isPrimitive(Class type)(Code) | | Returns true if the given class should be treated as a primitive
type
true if the given class should be treated as a primitivetype |
loadMapping | abstract public void loadMapping(MappingRoot mapping, Object param) throws MappingException(Code) | | Loads the mapping from the specified mapping object if not loaded previously.
Parameters: mapping - The mapping information. Parameters: param - Arbitrary parameter that can be used by subclasses. throws: MappingException - The mapping file is invalid. |
resolveType | final protected Class resolveType(String typeName) throws MappingException(Code) | | Returns the Java class for the named type. The type name can be one of the
accepted short names (e.g. integer) or the full Java class name (e.g.
java.lang.Integer). If the short name is used, the primitive type might
be returned.
|
|
|