org.exolab.castor.mapping.loader
public abstract class MappingLoader extends Object implements MappingResolver
Version: $Revision: 1.14 $ $Date: 2005/08/03 21:11:48 $
Nested Class Summary | |
---|---|
class | MappingLoader.TypeInfoReference
A class used to by the createFieldHandler method in order to
save the reference of the TypeInfo that was used. |
Field Summary | |
---|---|
protected static Class[] | EMPTY_ARGS
Empty array of class types used for reflection |
static ClassDescriptor | NoDescriptor |
protected static Class[] | STRING_ARG
The string argument for the valueOf method, used
for introspection when searching for type-safe
enumeration style classes. |
protected static String | VALUE_OF
Factory method name for type-safe enumerations.
|
Constructor Summary | |
---|---|
protected | MappingLoader(ClassLoader loader, PrintWriter logWriter)
Constructs a new mapping helper. |
Method Summary | |
---|---|
protected void | addDescriptor(ClassDescriptor clsDesc)
Adds a class descriptor. |
protected ClassDescriptor | createDescriptor(ClassMapping clsMap)
Creates a new descriptor. |
protected FieldDescriptor | createFieldDesc(Class javaClass, FieldMapping fieldMap)
Creates a single field descriptor. |
protected FieldDescriptor[] | createFieldDescs(Class javaClass, FieldMapping[] fieldMaps)
Create field descriptors. |
protected FieldHandler | createFieldHandler(Class javaClass, Class fieldType, FieldMapping fieldMap, MappingLoader.TypeInfoReference typeInfoRef)
Creates the FieldHandler for the given FieldMapping
|
protected static Method | findAccessor(Class javaClass, String methodName, Class fieldType, boolean getMethod)
Returns the named accessor. |
ClassLoader | getClassLoader() |
ClassDescriptor | getDescriptor(String className)
Returns the ClassDescriptor for the class with the given name.
|
ClassDescriptor | getDescriptor(Class type) |
protected PrintWriter | getLogWriter()
Returns the log writer. |
protected TypeInfo | getTypeInfo(Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap) |
protected static boolean | isPrimitive(Class type)
Returns true if the given class should be treated as a primitive
type |
Enumeration | listDescriptors() |
Enumeration | listJavaClasses() |
protected ClassDescriptor | loadClassDescriptor(String clsName)
Loads a class descriptor from a compiled class.
|
void | loadMapping(MappingRoot mapping, Object param)
Loads the mapping from the specified mapping object. |
protected void | resolveRelations(ClassDescriptor clsDesc) |
protected Class | resolveType(String typeName)
Returns the Java class for the named type. |
void | setAllowRedefinitions(boolean allow)
Enables or disables the ability to allow the redefinition
of class mappings.
|
Parameters: loader The class loader to use, null for the default
Parameters: clsDesc The descriptor to add
Throws: MappingException A descriptor for this class already exists
Parameters: clsMap The class mapping information
Throws: MappingException An exception indicating why mapping for the class cannot be created
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
Parameters: javaClass The class to which the fields belong fieldMaps The field mappings
Throws: MappingException An exception indicating why mapping for the class cannot be created
Parameters: javaClass the class type of the parent of the field fieldType the Java class type for the field. fieldMap the field mapping
Returns: the newly created FieldHandler
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
Parameters: className the className for which to return the associated ClassDescriptor.
Returns: the ClassDescriptor or null if not found.
Returns: true if the given class should be treated as a primitive type
Parameters: clsName The class for which the descriptor is loaded
Returns: An instance of the class descriptor or null if not found
Parameters: mapping The mapping information param Arbitrary parameter that can be used by subclasses
Throws: MappingException The mapping file is invalid
Parameters: allow a boolean that when true enables redefinitions.