Classes | |
class | TypeInfoReference |
Public Member Functions | |
ClassDescriptor | getDescriptor (String className) |
ClassDescriptor | getDescriptor (Class type) |
Enumeration | listDescriptors () |
Enumeration | listJavaClasses () |
ClassLoader | getClassLoader () |
void | loadMapping (MappingRoot mapping, Object param) throws MappingException |
void | setAllowRedefinitions (boolean allow) |
Static Public Attributes | |
static final ClassDescriptor | NoDescriptor = new ClassDescriptorImpl( Class.class ) |
Protected Member Functions | |
MappingLoader (ClassLoader loader, PrintWriter logWriter) | |
PrintWriter | getLogWriter () |
Class | resolveType (String typeName) throws ClassNotFoundException |
void | addDescriptor (ClassDescriptor clsDesc) throws MappingException |
void | resolveRelations (ClassDescriptor clsDesc) throws MappingException |
ClassDescriptor | createDescriptor (ClassMapping clsMap) throws MappingException |
FieldDescriptor[] | createFieldDescs (Class javaClass, FieldMapping[] fieldMaps) throws MappingException |
FieldDescriptor | createFieldDesc (Class javaClass, FieldMapping fieldMap) throws MappingException |
FieldHandler | createFieldHandler (Class javaClass, Class fieldType, FieldMapping fieldMap, TypeInfoReference typeInfoRef) throws MappingException |
TypeInfo | getTypeInfo (Class fieldType, CollectionHandler colHandler, FieldMapping fieldMap) throws MappingException |
ClassDescriptor | loadClassDescriptor (String clsName) |
Static Protected Member Functions | |
static final Method | findAccessor (Class javaClass, String methodName, Class fieldType, boolean getMethod) throws MappingException |
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.
org.exolab.castor.mapping.loader.MappingLoader.MappingLoader | ( | ClassLoader | loader, | |
PrintWriter | logWriter | |||
) | [protected] |
Constructs a new mapping helper. This constructor is used by a derived class.
loader | The class loader to use, null for the default |
void org.exolab.castor.mapping.loader.MappingLoader.addDescriptor | ( | ClassDescriptor | clsDesc | ) | throws MappingException [protected] |
Adds a class descriptor. Will throw a mapping exception if a descriptor for this class already exists.
clsDesc | The descriptor to add |
MappingException | A descriptor for this class already exists |
Referenced by org.exolab.castor.mapping.loader.MappingLoader.loadMapping().
ClassDescriptor org.exolab.castor.mapping.loader.MappingLoader.createDescriptor | ( | ClassMapping | clsMap | ) | throws MappingException [protected] |
Creates a new descriptor. The class mapping information is used to create a new stock 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 created |
Reimplemented in org.exolab.castor.xml.XMLMappingLoader.
References org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(), org.exolab.castor.mapping.ClassDescriptor.getAccessMode(), org.exolab.castor.mapping.loader.MappingLoader.getDescriptor(), org.exolab.castor.mapping.xml.ClassMapping.getExtends(), org.exolab.castor.mapping.loader.ClassDescriptorImpl.getIdentities(), org.exolab.castor.mapping.ClassDescriptor.getIdentity(), org.exolab.castor.mapping.xml.ClassMapping.getIdentity(), org.exolab.castor.mapping.loader.MappingLoader.loadClassDescriptor(), org.exolab.castor.mapping.loader.MappingLoader.NoDescriptor, and org.exolab.castor.mapping.loader.MappingLoader.resolveType().
Referenced by org.exolab.castor.mapping.loader.MappingLoader.loadMapping().
FieldDescriptor org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc | ( | Class | javaClass, | |
FieldMapping | fieldMap | |||
) | throws MappingException [protected] |
Create container field descriptor. The contained mapping is used to create a single field descriptor which includes several field descriptors for all contained fields.
javaClass | The class to which the field belongs | |
fieldMap | The field mapping |
MappingException | An exception indicating why mapping for the class cannot be created 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. |
javaClass | The class to which the field belongs | |
fieldMap | The field mapping information |
MappingException | The field or its accessor methods are not found, not accessible, not of the specified type, etc |
Reimplemented in org.exolab.castor.xml.XMLMappingLoader.
References org.exolab.castor.mapping.loader.MappingLoader.createFieldHandler(), org.exolab.castor.mapping.loader.TypeInfo.getCollectionHandler(), org.exolab.castor.mapping.loader.MappingLoader.getTypeInfo(), org.exolab.castor.mapping.FieldHandler.newInstance(), org.exolab.castor.mapping.loader.MappingLoader.resolveType(), org.exolab.castor.mapping.loader.TypeInfo.setCollectionHandler(), org.exolab.castor.mapping.loader.FieldDescriptorImpl.setRequired(), and org.exolab.castor.mapping.loader.MappingLoader.TypeInfoReference.typeInfo.
Referenced by org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs().
FieldDescriptor [] org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs | ( | Class | javaClass, | |
FieldMapping[] | fieldMaps | |||
) | throws MappingException [protected] |
Create field descriptors. The class mapping information is used to create descriptors for all the fields in the class, except for container fields. Implementations may extend this method to create more suitable descriptors, or create descriptors only for a subset of the fields.
javaClass | The class to which the fields belong | |
fieldMaps | The field mappings |
MappingException | An exception indicating why mapping for the class cannot be created |
References org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc().
Referenced by org.exolab.castor.mapping.loader.MappingLoader.createDescriptor().
FieldHandler org.exolab.castor.mapping.loader.MappingLoader.createFieldHandler | ( | Class | javaClass, | |
Class | fieldType, | |||
FieldMapping | fieldMap, | |||
TypeInfoReference | typeInfoRef | |||
) | throws MappingException [protected] |
Creates the FieldHandler for the given FieldMapping
javaClass | the class type of the parent of the field | |
fieldType | the Java class type for the field. | |
fieldMap | the field mapping |
References org.exolab.castor.mapping.loader.MappingLoader.findAccessor(), org.exolab.castor.mapping.xml.FieldMapping.getCollection(), org.exolab.castor.mapping.xml.FieldMapping.getCreateMethod(), org.exolab.castor.mapping.xml.FieldMapping.getDirect(), org.exolab.castor.mapping.xml.FieldMapping.getGetMethod(), org.exolab.castor.mapping.xml.FieldMapping.getHasMethod(), org.exolab.castor.mapping.xml.FieldMapping.getName(), org.exolab.castor.mapping.xml.FieldMapping.getSetMethod(), org.exolab.castor.mapping.loader.MappingLoader.getTypeInfo(), org.exolab.castor.mapping.loader.FieldHandlerImpl.setAddMethod(), org.exolab.castor.mapping.loader.FieldHandlerImpl.setCreateMethod(), org.exolab.castor.mapping.loader.FieldHandlerImpl.setHasDeleteMethod(), and org.exolab.castor.mapping.loader.MappingLoader.TypeInfoReference.typeInfo.
Referenced by org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc().
static final Method org.exolab.castor.mapping.loader.MappingLoader.findAccessor | ( | Class | javaClass, | |
String | methodName, | |||
Class | fieldType, | |||
boolean | getMethod | |||
) | throws MappingException [static, protected] |
Returns the named accessor. Uses reflection to return the named accessor and check the return value or parameter type, if specified.
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 |
MappingException | The method is not accessible or is not of the specified type |
Referenced by org.exolab.castor.tools.MappingTool.InternalLoader.canFindAccessors(), org.exolab.castor.mapping.loader.MappingLoader.createFieldHandler(), and org.exolab.castor.tools.MappingTool.InternalLoader.returnsArray().
ClassLoader org.exolab.castor.mapping.loader.MappingLoader.getClassLoader | ( | ) |
Returns the class loader associated with this mapping resolver if one was specified. This is the class loader used to load all the classes mapped by this mapping resolver. May be null if no class loader was specified or in certain JVMs.
Implements org.exolab.castor.mapping.MappingResolver.
ClassDescriptor org.exolab.castor.mapping.loader.MappingLoader.getDescriptor | ( | String | className | ) |
Returns the ClassDescriptor for the class with the given name. If no such ClassDescriptor exists, within the set of mappings for this MappingLoader, null will be returned.
className | the className for which to return the associated ClassDescriptor. |
Referenced by org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(), org.exolab.castor.xml.util.ClassDescriptorResolverImpl.resolve(), org.exolab.castor.xml.XMLMappingLoader.resolveRelations(), and org.exolab.castor.mapping.loader.MappingLoader.resolveRelations().
ClassDescriptor org.exolab.castor.mapping.loader.MappingLoader.getDescriptor | ( | Class | javaClass | ) |
Returns the class descriptor for the specified Java class. In no such descriptor exists, returns null.
javaClass | The Java class |
Implements org.exolab.castor.mapping.MappingResolver.
PrintWriter org.exolab.castor.mapping.loader.MappingLoader.getLogWriter | ( | ) | [protected] |
Returns the log writer. If not null, errors and other messages should be directed to the log writer.
TypeInfo org.exolab.castor.mapping.loader.MappingLoader.getTypeInfo | ( | Class | fieldType, | |
CollectionHandler | colHandler, | |||
FieldMapping | fieldMap | |||
) | throws MappingException [protected] |
Enumeration org.exolab.castor.mapping.loader.MappingLoader.listDescriptors | ( | ) |
Returns an enumeration of all the known descriptors. Each element is of type ClassDescriptor.
Implements org.exolab.castor.mapping.MappingResolver.
Referenced by org.exolab.castor.xml.util.ClassDescriptorResolverImpl.resolveAllByXMLName(), and org.exolab.castor.xml.util.ClassDescriptorResolverImpl.resolveByXMLName().
Enumeration org.exolab.castor.mapping.loader.MappingLoader.listJavaClasses | ( | ) |
Returns an enumeration of all the supported Java classes. Each element is of type java.lang.Class
, and for each such class a suitable descriptor exists.
Implements org.exolab.castor.mapping.MappingResolver.
ClassDescriptor org.exolab.castor.mapping.loader.MappingLoader.loadClassDescriptor | ( | String | clsName | ) | [protected] |
Loads a class descriptor from a compiled class.
clsName | The class for which the descriptor is loaded |
Temporarily disabled clsName = clsName + CompiledSuffix; try { Object obj;
obj = resolveType( clsName ).newInstance(); if ( obj instanceof ClassDescriptor ) return (ClassDescriptor) obj; return null; } catch ( Exception except ) { return null; }
Referenced by org.exolab.castor.xml.XMLMappingLoader.createDescriptor(), and org.exolab.castor.mapping.loader.MappingLoader.createDescriptor().
void org.exolab.castor.mapping.loader.MappingLoader.loadMapping | ( | MappingRoot | mapping, | |
Object | param | |||
) | throws MappingException |
Loads the mapping from the specified mapping object. Calls createDescriptor to create each descriptor and addDescriptor to store it. Also loads all the included mapping files.
mapping | The mapping information | |
param | Arbitrary parameter that can be used by subclasses |
MappingException | The mapping file is invalid |
References org.exolab.castor.mapping.loader.MappingLoader.addDescriptor(), org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(), org.exolab.castor.mapping.xml.ClassMapping.getName(), org.exolab.castor.mapping.loader.MappingLoader.NoDescriptor, and org.exolab.castor.mapping.loader.MappingLoader.resolveRelations().
Referenced by org.exolab.castor.mapping.Mapping.getResolver().
void org.exolab.castor.mapping.loader.MappingLoader.resolveRelations | ( | ClassDescriptor | clsDesc | ) | throws MappingException [protected] |
Class org.exolab.castor.mapping.loader.MappingLoader.resolveType | ( | String | typeName | ) | throws ClassNotFoundException [protected] |
Returns the Java class for the named type. The type name can be one of the accepted short names (e.g. integer
) or the full Java class name (e.g. java.lang.Integer
). If the short name is used, the primitive type might be returned.
Referenced by org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(), and org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc().
void org.exolab.castor.mapping.loader.MappingLoader.setAllowRedefinitions | ( | boolean | allow | ) |
Enables or disables the ability to allow the redefinition of class mappings.
allow | a boolean that when true enables redefinitions. |
Referenced by org.exolab.castor.mapping.Mapping.getResolver().
final ClassDescriptor org.exolab.castor.mapping.loader.MappingLoader.NoDescriptor = new ClassDescriptorImpl( Class.class ) [static] |