Package org.exolab.castor.xml
Class XMLMappingLoader
- java.lang.Object
-
- org.exolab.castor.mapping.loader.AbstractMappingLoader2
-
- org.exolab.castor.mapping.loader.AbstractMappingLoader
-
- org.exolab.castor.xml.XMLMappingLoader
-
- All Implemented Interfaces:
MappingLoader
public final class XMLMappingLoader extends AbstractMappingLoader
An XML implementation of mapping helper. Creates XML class descriptors from the mapping file.- Version:
- $Revision: 8152 $ $Date: 2006-02-23 01:37:50 -0700 (Thu, 23 Feb 2006) $
- Author:
- Keith Visco, Assaf Arkin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classXMLMappingLoader.IdentityConvertorA special TypeConvertor that simply returns the object given.-
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
NAME
-
-
Constructor Summary
Constructors Constructor Description XMLMappingLoader(java.lang.ClassLoader loader)Creates a new XMLMappingLoader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ClassDescriptorcreateClassDescriptor(ClassMapping classMapping)To create the class descriptor for the given class mapping.protected FieldDescriptorImplcreateFieldDesc(java.lang.Class javaClass, FieldMapping fieldMap)Creates a single field descriptor.protected FieldDescriptorfindIdentityByName(java.util.List fldList, java.lang.String idName, java.lang.Class javaClass)BindingTypegetBindingType()protected TypeInfogetTypeInfo(java.lang.Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap)voidloadMapping(MappingRoot mapping, java.lang.Object param)Loads the mapping from the specified mapping object if not loaded previously.protected voidresolveRelations(ClassDescriptor clsDesc)voidsetLoadPackageMappings(boolean loadPackageMappings)Sets whether or not to look for and load package specific mapping files (".castor.xml" files).-
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, setInternalContext
-
Methods inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader2
addDescriptor, clear, getClassLoader, getDescriptor, getDescriptors, isAllowRedefinition, loadMapping, setAllowRedefinitions, setClassLoader
-
-
-
-
Method Detail
-
getBindingType
public BindingType getBindingType()
-
loadMapping
public void loadMapping(MappingRoot mapping, java.lang.Object param) throws MappingException
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
protected ClassDescriptor createClassDescriptor(ClassMapping classMapping) throws MappingException
To create the class descriptor for the given class mapping. Throws IllegalStateException if the class has no valid internal context.- Specified by:
createClassDescriptorin classAbstractMappingLoader- Parameters:
classMapping- the class mapping information to process- Returns:
- the
ClassDescriptorcreated for the class mapping - Throws:
MappingException- ...
-
findIdentityByName
protected final FieldDescriptor findIdentityByName(java.util.List fldList, java.lang.String idName, java.lang.Class javaClass)
-
resolveRelations
protected final void resolveRelations(ClassDescriptor clsDesc)
- Specified by:
resolveRelationsin classAbstractMappingLoader
-
createFieldDesc
protected FieldDescriptorImpl createFieldDesc(java.lang.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.
-
setLoadPackageMappings
public void setLoadPackageMappings(boolean loadPackageMappings)
Sets whether or not to look for and load package specific mapping files (".castor.xml" files).- Parameters:
loadPackageMappings- a boolean that enables or disables the loading of package specific mapping files
-
getTypeInfo
protected TypeInfo getTypeInfo(java.lang.Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap) throws MappingException
- Overrides:
getTypeInfoin classAbstractMappingLoader- Throws:
MappingException
-
-