org.exolab.castor.xml

Class XMLMappingLoader

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: 7304 $ $Date: 2006-02-23 01:37:50 -0700 (Thu, 23 Feb 2006) $
Authors:
Keith Visco
Assaf Arkin

Nested Class Summary

(package private) class
XMLMappingLoader.IdentityConvertor
A 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

EMPTY_ARGS, STRING_ARG, VALUE_OF

Constructor Summary

XMLMappingLoader(ClassLoader loader)
Creates a new XMLMappingLoader.

Method Summary

protected ClassDescriptor
createClassDescriptor(ClassMapping clsMap)
To create the class descriptor for the given class mapping.
protected AbstractFieldDescriptor
createFieldDesc(Class javaClass, FieldMapping fieldMap)
Creates a single field descriptor.
protected FieldDescriptor
findIdentityByName(List fldList, String idName, Class javaClass)
BindingType
getBindingType()
protected TypeInfo
getTypeInfo(Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap)
void
loadMapping(MappingRoot mapping, Object param)
protected void
resolveRelations(ClassDescriptor clsDesc)
void
setLoadPackageMappings(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, createClassDescriptor, createClassDescriptors, createFieldDesc, createFieldDescriptors, createFieldHandler, createFieldHandlers, divideFieldDescriptors, findAccessor, getDepended, getExtended, getIdColumnIndex, getIdentityColumnNames, getInternalContext, getOrigin, getSourceType, getTypeInfo, isPrimitive, loadMapping, resolveRelations, resolveType, setInternalContext

Methods inherited from class org.exolab.castor.mapping.loader.AbstractMappingLoader2

addDescriptor, clear, descriptorIterator, getClassLoader, getDescriptor, isAllowRedefinition, loadMapping, setAllowRedefinitions, setClassLoader

Constructor Details

XMLMappingLoader

public XMLMappingLoader(ClassLoader loader)
Creates a new XMLMappingLoader. Joachim 2007-08-19: called via ClassLoader from XMLMappingLoaderFactory.getMappingLoader() must not be modified!!!
Parameters:
loader - the class loader to use

Method Details

createClassDescriptor

protected ClassDescriptor createClassDescriptor(ClassMapping clsMap)
            throws MappingException
To create the class descriptor for the given class mapping. Throws IllegalStateException if the class has no valid internal context.
Overrides:
createClassDescriptor in interface AbstractMappingLoader
Parameters:
clsMap - the class mapping information to process
Returns:
the ClassDescriptor created for the class mapping
Throws:
MappingException - ...

createFieldDesc

protected AbstractFieldDescriptor createFieldDesc(Class javaClass,
                                                  FieldMapping fieldMap)
            throws MappingException
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.
Overrides:
createFieldDesc in interface AbstractMappingLoader
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.

findIdentityByName

protected final FieldDescriptor findIdentityByName(List fldList,
                                                   String idName,
                                                   Class javaClass)

getBindingType

public BindingType getBindingType()
Specified by:
getBindingType in interface MappingLoader

getTypeInfo

protected TypeInfo getTypeInfo(Class fieldType,
                               CollectionHandler colHandler,
                               FieldMapping fieldMap)
            throws MappingException
Overrides:
getTypeInfo in interface AbstractMappingLoader

loadMapping

public void loadMapping(MappingRoot mapping,
                        Object param)
            throws MappingException
Overrides:
loadMapping in interface AbstractMappingLoader

resolveRelations

protected final void resolveRelations(ClassDescriptor clsDesc)
Overrides:
resolveRelations in interface AbstractMappingLoader

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

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com