Package org.exolab.castor.jdo.engine
Class JDOMappingLoader
java.lang.Object
org.exolab.castor.mapping.loader.AbstractMappingLoader2
org.exolab.castor.mapping.loader.AbstractMappingLoader
org.exolab.castor.jdo.engine.JDOMappingLoader
- All Implemented Interfaces:
MappingLoader
A JDO implementation of mapping helper. Creates JDO class descriptors
from the mapping file.
- Version:
- $Revision: 8749 $ $Date: 2006-04-13 07:37:49 -0600 (Thu, 13 Apr 2006) $
- Author:
- Assaf Arkin, Ralf Joachim
-
Nested Class Summary
Nested classes/interfaces inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader
AbstractMappingLoader.TypeInfoReference -
Field Summary
Fields inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader
EMPTY_ARGS, NAME, STRING_ARG, VALUE_OF -
Constructor Summary
ConstructorsConstructorDescriptionJDOMappingLoader(ClassLoader loader) Creates an instance ofJDOMappingLoader, providing aClassLoaderinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected ClassDescriptorcreateClassDescriptor(ClassMapping classMapping) protected FieldDescriptorImplcreateFieldDesc(Class javaClass, FieldMapping fieldMap) Creates a single field descriptor.static Stringdefinition2param(String sqlTypeDef) Extracts parameter for type convertor from the SQL type definition of the form "SQL_TYPE_NAME[PARAMETER]".static Stringdefinition2type(String sqlTypeDef) Extracts SQL type name from the the SQL type definition of the form "SQL_TYPE_NAME[PARAMETER]".protected FieldDescriptorfindIdentityByName(List<FieldDescriptor> fldList, String idName, Class javaClass) protected String[]getSqlTypes(FieldMapping fieldMap) Parse the sql type attribute to build an array of types, needed to support whitespace inside parameterized types (see Bug 1045).protected TypeInfogetTypeInfo(Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap) voidloadMapping(MappingRoot mapping, Object param) Loads the mapping from the specified mapping object if not loaded previously.protected voidresolveRelations(ClassDescriptor clsDesc) Walks through all fields of a descriptor and resolves relationClassDescriptors by using mapping information or, if not present, resolution by file to support generatedClassDescriptors.Methods inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader
checkFieldNameDuplicates, createClassDescriptors, createFieldDescriptors, createFieldHandler, createFieldHandlers, divideFieldDescriptors, findAccessor, getDepended, getExtended, getIdColumnIndex, getIdentityColumnNames, getInternalContext, getOrigin, getSourceType, isPrimitive, resolveType, setInternalContextMethods inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader2
addDescriptor, clear, getClassLoader, getDescriptor, getDescriptors, isAllowRedefinition, loadMapping, setAllowRedefinitions, setClassLoader
-
Constructor Details
-
JDOMappingLoader
Creates an instance ofJDOMappingLoader, providing aClassLoaderinstance.- Parameters:
loader- A CustomClassLoaderinstance.
-
-
Method Details
-
definition2param
Extracts parameter for type convertor from the SQL type definition of the form "SQL_TYPE_NAME[PARAMETER]". If the type is not parameterized, returns null.- Parameters:
sqlTypeDef- SQL type definition (e.g. char[01]).- Returns:
- Parameter (e.g. "01") or null if not parameterized.
-
definition2type
Extracts SQL type name from the the SQL type definition of the form "SQL_TYPE_NAME[PARAMETER]".- Parameters:
sqlTypeDef- SQL type definition (e.g. char[01]).- Returns:
- SQL type name (e.g. "char").
-
getBindingType
-
loadMapping
Loads the mapping from the specified mapping object if not loaded previously.- Specified by:
loadMappingin classAbstractMappingLoader- Parameters:
mapping- The mapping information.param- Arbitrary parameter that can be used by subclasses.- Throws:
MappingException- The mapping file is invalid.
-
createClassDescriptor
- Specified by:
createClassDescriptorin classAbstractMappingLoader- Throws:
MappingException
-
findIdentityByName
protected FieldDescriptor findIdentityByName(List<FieldDescriptor> fldList, String idName, Class javaClass) throws MappingException - Throws:
MappingException
-
resolveRelations
Walks through all fields of a descriptor and resolves relationClassDescriptors by using mapping information or, if not present, resolution by file to support generatedClassDescriptors. ResolvedClassDescriptors will be set as a field's descriptor.- Specified by:
resolveRelationsin classAbstractMappingLoader- Parameters:
clsDesc- The ClassDescriptor in focus.
-
getSqlTypes
Parse the sql type attribute to build an array of types, needed to support whitespace inside parameterized types (see Bug 1045). -
getTypeInfo
protected TypeInfo getTypeInfo(Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap) throws MappingException - Overrides:
getTypeInfoin classAbstractMappingLoader- Throws:
MappingException
-
createFieldDesc
protected FieldDescriptorImpl createFieldDesc(Class javaClass, FieldMapping fieldMap) throws MappingException Description copied from class:AbstractMappingLoaderCreates a single field descriptor. The field mapping is used to create a new stockFieldDescriptor. Implementations may extend this class to create a more suitable descriptor.- Overrides:
createFieldDescin classAbstractMappingLoader- Parameters:
javaClass- The class to which the field belongs.fieldMap- The field mapping information.- Returns:
- The field descriptor.
- Throws:
MappingException- The field or its accessor methods are not found, not accessible, not of the specified type, etc.
-