|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.mapping.loader.MappingLoader
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.
Field Summary | |
static ClassDescriptor |
NoDescriptor
|
Constructor Summary | |
protected |
MappingLoader(java.lang.ClassLoader loader,
java.io.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(java.lang.Class javaClass,
FieldMapping fieldMap)
Creates a single field descriptor. |
protected FieldDescriptor[] |
createFieldDescs(java.lang.Class javaClass,
FieldMapping[] fieldMaps)
Create field descriptors. |
java.lang.ClassLoader |
getClassLoader()
Returns the class loader associated with this mapping resolver if one was specified. |
ClassDescriptor |
getDescriptor(java.lang.Class type)
Returns the class descriptor for the specified Java class. |
protected java.io.PrintWriter |
getLogWriter()
Returns the log writer. |
protected TypeInfo |
getTypeInfo(java.lang.Class fieldType,
CollectionHandler colHandler,
FieldMapping fieldMap)
|
java.util.Enumeration |
listDescriptors()
Returns an enumeration of all the known descriptors. |
java.util.Enumeration |
listJavaClasses()
Returns an enumeration of all the supported Java classes. |
protected ClassDescriptor |
loadClassDescriptor(java.lang.String clsName)
Loads a class descriptor from a compiled class. |
void |
loadMapping(MappingRoot mapping,
java.lang.Object param)
Loads the mapping from the specified mapping object. |
protected void |
resolveRelations(ClassDescriptor clsDesc)
|
protected java.lang.Class |
resolveType(java.lang.String typeName)
Returns the Java class for the named type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ClassDescriptor NoDescriptor
Constructor Detail |
protected MappingLoader(java.lang.ClassLoader loader, java.io.PrintWriter logWriter)
loader
- The class loader to use, null for the defaultMethod Detail |
public ClassDescriptor getDescriptor(java.lang.Class type)
MappingResolver
getDescriptor
in interface MappingResolver
type
- The Java class
public java.util.Enumeration listDescriptors()
MappingResolver
ClassDescriptor
.
listDescriptors
in interface MappingResolver
public java.util.Enumeration listJavaClasses()
MappingResolver
listJavaClasses
in interface MappingResolver
public java.lang.ClassLoader getClassLoader()
MappingResolver
getClassLoader
in interface MappingResolver
protected java.io.PrintWriter getLogWriter()
protected java.lang.Class resolveType(java.lang.String typeName) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public void loadMapping(MappingRoot mapping, java.lang.Object param) throws MappingException
createDescriptor(org.exolab.castor.mapping.xml.ClassMapping)
to create each descriptor and addDescriptor(org.exolab.castor.mapping.ClassDescriptor)
to store it. Also loads all the included mapping
files.
mapping
- The mapping informationparam
- Arbitrary parameter that can be used by subclasses
MappingException
- The mapping file is invalidprotected void addDescriptor(ClassDescriptor clsDesc) throws MappingException
clsDesc
- The descriptor to add
MappingException
- A descriptor for this class already
existsprotected void resolveRelations(ClassDescriptor clsDesc) throws MappingException
MappingException
protected ClassDescriptor createDescriptor(ClassMapping clsMap) throws MappingException
ClassDescriptor
. Implementations may
extend this class to create a more suitable descriptor.
clsMap
- The class mapping information
MappingException
- An exception indicating why mapping for
the class cannot be createdprotected FieldDescriptor[] createFieldDescs(java.lang.Class javaClass, FieldMapping[] fieldMaps) throws MappingException
javaClass
- The class to which the fields belongfieldMaps
- The field mappings
MappingException
- An exception indicating why mapping for
the class cannot be createdprotected FieldDescriptor createFieldDesc(java.lang.Class javaClass, FieldMapping fieldMap) throws MappingException
FieldDescriptor
. Implementations may
extend this class to create a more suitable descriptor.
javaClass
- The class to which the field belongsfieldMap
- The field mapping information
MappingException
- The field or its accessor methods are not
found, not accessible, not of the specified type, etcprotected TypeInfo getTypeInfo(java.lang.Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap) throws MappingException
MappingException
protected ClassDescriptor loadClassDescriptor(java.lang.String clsName)
clsName
- The class for which the descriptor is loaded
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |