org.exolab.castor.xml.util
Class XMLClassDescriptorResolverImpl

java.lang.Object
  extended by org.exolab.castor.xml.util.XMLClassDescriptorResolverImpl
All Implemented Interfaces:
ClassDescriptorResolver, XMLClassDescriptorResolver

public class XMLClassDescriptorResolverImpl
extends java.lang.Object
implements XMLClassDescriptorResolver

The default implementation of the ClassDescriptorResolver interface.

Version:
$Revision: 6910 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
Author:
Keith Visco

Constructor Summary
XMLClassDescriptorResolverImpl()
          Creates a new ClassDescriptorResolverImpl.
 
Method Summary
 void addClass(java.lang.String className)
          Loads the class descriptor for the class instance specified.
 void addClasses(java.lang.String[] classNames)
          Loads the class descriptors for the class instances specified.
 void addPackage(java.lang.String packageName)
          Loads class descriptors from the package specified.
 void addPackages(java.lang.String[] packageNames)
          Loads class descriptors from the packages specified.
 Introspector getIntrospector()
          Returns the Introspector being used by this ClassDescriptorResolver.
 MappingLoader getMappingLoader()
          
Note: This method will be removed soon (kv).
 void loadClassDescriptors(java.lang.String packageName)
          Loads class descriptors from the package specified.
 ClassDescriptor resolve(java.lang.Class type)
          Returns the ClassDescriptor for the given class
 XMLClassDescriptor resolve(java.lang.String className)
          Returns the XMLClassDescriptor for the given class name
 XMLClassDescriptor resolve(java.lang.String className, java.lang.ClassLoader loader)
          Returns the XMLClassDescriptor for the given class name
 java.util.Iterator resolveAllByXMLName(java.lang.String xmlName, java.lang.String namespaceURI, java.lang.ClassLoader loader)
          Returns an enumeration of XMLClassDescriptor objects that match the given xml name.
 XMLClassDescriptor resolveByXMLName(java.lang.String xmlName, java.lang.String namespaceURI, java.lang.ClassLoader loader)
          Returns the first XMLClassDescriptor that matches the given XML name and namespaceURI.
 void setClassLoader(java.lang.ClassLoader loader)
          Sets the ClassLoader to use when loading class descriptors
 void setIntrospection(boolean enable)
          Enables or disables introspection.
 void setLoadPackageMappings(boolean loadPackageMappings)
          Sets whether or not to look for and load package specific mapping files (".castor.xml" files).
 void setMappingLoader(MappingLoader mappingLoader)
          Sets the mapping loader for this ClassDescriptorResolver
Note: This method will be removed soon (kv).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLClassDescriptorResolverImpl

public XMLClassDescriptorResolverImpl()
Creates a new ClassDescriptorResolverImpl.

Method Detail

getIntrospector

public Introspector getIntrospector()
Returns the Introspector being used by this ClassDescriptorResolver. This allows for configuration of the Introspector.

Returns:
the Introspector being used by this ClassDescriptorResolver

getMappingLoader

public MappingLoader getMappingLoader()

Note: This method will be removed soon (kv).

Specified by:
getMappingLoader in interface ClassDescriptorResolver
See Also:
ClassDescriptorResolver.getMappingLoader()

resolve

public ClassDescriptor resolve(java.lang.Class type)
                        throws ResolverException
Returns the ClassDescriptor for the given class

Specified by:
resolve in interface ClassDescriptorResolver
Parameters:
type - the Class to find the ClassDescriptor for
Returns:
the ClassDescriptor for the given class
Throws:
ResolverException
See Also:
ClassDescriptorResolver.resolve(java.lang.Class)

resolve

public XMLClassDescriptor resolve(java.lang.String className)
                           throws ResolverException
Returns the XMLClassDescriptor for the given class name

Specified by:
resolve in interface XMLClassDescriptorResolver
Parameters:
className - the class name to find the XMLClassDescriptor for
Returns:
the XMLClassDescriptor for the given class name
Throws:
ResolverException
See Also:
XMLClassDescriptorResolver.resolve(java.lang.String)

resolve

public XMLClassDescriptor resolve(java.lang.String className,
                                  java.lang.ClassLoader loader)
                           throws ResolverException
Returns the XMLClassDescriptor for the given class name

Specified by:
resolve in interface XMLClassDescriptorResolver
Parameters:
className - the class name to find the XMLClassDescriptor for
loader - the ClassLoader to use
Returns:
the XMLClassDescriptor for the given class name
Throws:
ResolverException
See Also:
XMLClassDescriptorResolver.resolve(java.lang.String, java.lang.ClassLoader)

resolveByXMLName

public XMLClassDescriptor resolveByXMLName(java.lang.String xmlName,
                                           java.lang.String namespaceURI,
                                           java.lang.ClassLoader loader)
Returns the first XMLClassDescriptor that matches the given XML name and namespaceURI. Null is returned if no descriptor can be found.

Specified by:
resolveByXMLName in interface XMLClassDescriptorResolver
Parameters:
xmlName - The class name to find the XMLClassDescriptor for.
loader - The ClassLoader to use.
Returns:
The XMLClassDescriptor for the given XML name.
See Also:
XMLClassDescriptorResolver.resolveByXMLName(java.lang.String, java.lang.String, java.lang.ClassLoader)

resolveAllByXMLName

public java.util.Iterator resolveAllByXMLName(java.lang.String xmlName,
                                              java.lang.String namespaceURI,
                                              java.lang.ClassLoader loader)
Returns an enumeration of XMLClassDescriptor objects that match the given xml name.

Specified by:
resolveAllByXMLName in interface XMLClassDescriptorResolver
Parameters:
xmlName - The class name to find the XMLClassDescriptor for.
loader - The ClassLoader to use.
Returns:
An Iterator of XMLClassDescriptor objects.
See Also:
XMLClassDescriptorResolver.resolveAllByXMLName(java.lang.String, java.lang.String, java.lang.ClassLoader)

setClassLoader

public void setClassLoader(java.lang.ClassLoader loader)
Sets the ClassLoader to use when loading class descriptors

Specified by:
setClassLoader in interface XMLClassDescriptorResolver
Parameters:
loader - the ClassLoader to use
See Also:
XMLClassDescriptorResolver.setClassLoader(java.lang.ClassLoader)

setIntrospection

public void setIntrospection(boolean enable)
Enables or disables introspection. Introspection is enabled by default.

Parameters:
enable - a flag to indicate whether or not introspection is allowed.

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

setMappingLoader

public void setMappingLoader(MappingLoader mappingLoader)
Sets the mapping loader for this ClassDescriptorResolver
Note: This method will be removed soon (kv).

Specified by:
setMappingLoader in interface ClassDescriptorResolver
See Also:
ClassDescriptorResolver.setMappingLoader(org.exolab.castor.mapping.MappingLoader)

addClass

public void addClass(java.lang.String className)
Loads the class descriptor for the class instance specified. The use of this method is useful when no mapping is used, as happens when the domain classes hase been generated using the XML code generator (in which case instead of a mapping file class descriptor files will be generated).

Specified by:
addClass in interface XMLClassDescriptorResolver
Parameters:
className - Name of the class for which the associated descriptor should be loaded.

addClasses

public void addClasses(java.lang.String[] classNames)
Loads the class descriptors for the class instances specified. The use of this method is useful when no mapping is used, as happens when the domain classes hase been generated using the XML code generator (in which case instead of a mapping file class descriptor files will be generated).

Specified by:
addClasses in interface XMLClassDescriptorResolver
Parameters:
classNames - Names of the classes for which the associated descriptors should be loaded.

addPackage

public void addPackage(java.lang.String packageName)
                throws ResolverException
Loads class descriptors from the package specified. The use of this method is useful when no mapping is used, as happens when the domain classes hase been generated using the XML code generator (in which case instead of a mapping file class descriptor files will be generated).

Please note that this functionality will work only if you provide the .castor.cdr file with your generated classes (as generated by the XML code generator).

Specified by:
addPackage in interface XMLClassDescriptorResolver
Parameters:
packageName - The package name for the (descriptor) classes
Throws:
ResolverException - If there's a problem loading class descriptors for the given package.

addPackages

public void addPackages(java.lang.String[] packageNames)
                 throws ResolverException
Loads class descriptors from the packages specified. The use of this method is useful when no mapping is used, as happens when the domain classes hase been generated using the XML code generator (in which case instead of a mapping file class descriptor files will be generated).

Please note that this functionality will work only if you provide the .castor.cdr files with your generated classes (as generated by the XML code generator).

Specified by:
addPackages in interface XMLClassDescriptorResolver
Parameters:
packageNames - The package names for the (descriptor) classes
Throws:
ResolverException - If there's a problem loading class descriptors for the given package.

loadClassDescriptors

public void loadClassDescriptors(java.lang.String packageName)
                          throws ResolverException
Loads class descriptors from the package specified. The use of this method is useful when no mapping is used, as happens when the domain classes hase been generated using the XML code generator (in which case instead of a mapping file class descriptor files will be generated).

Please note that this functionality will work only if you provide the .castor.cdr file with your generated classes (as generated by the XML code generator).

Specified by:
loadClassDescriptors in interface XMLClassDescriptorResolver
Parameters:
packageName - The package name for the (descriptor) classes
Throws:
ResolverException - If there's a problem loading class descriptors for the given package.


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