org.exolab.castor.xml.util
Class XMLClassDescriptorResolverImpl

java.lang.Object
  extended byorg.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: 6795 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
Author:
Keith Visco

Nested Class Summary
(package private) static class XMLClassDescriptorResolverImpl.XCDEnumerator
          A locally used implementation of ClassDescriptorEnumeration
 
Constructor Summary
XMLClassDescriptorResolverImpl()
          Creates a new ClassDescriptorResolverImpl.
 
Method Summary
 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. 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 mpping file class descriptor files will be generated).
 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
 ClassDescriptorEnumeration 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. Null is returned if no descriptor can be found.
 XMLClassDescriptor resolveXML(java.lang.Class type)
          Returns the XMLClassDescriptor for the given class
 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()

resolveXML

public XMLClassDescriptor resolveXML(java.lang.Class type)
                              throws ResolverException
Returns the XMLClassDescriptor for the given class

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

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 ClassDescriptorEnumeration 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 enumeration 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)

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 mpping file class descriptor files will be generated).

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