org.castor.cpa.util
Class JDOClassDescriptorResolverImpl

java.lang.Object
  extended by org.castor.cpa.util.JDOClassDescriptorResolverImpl
All Implemented Interfaces:
JDOClassDescriptorResolver, ClassDescriptorResolver

public class JDOClassDescriptorResolverImpl
extends Object
implements JDOClassDescriptorResolver

JDO-specific ClassDescriptorResolver instance that provides functionality to find or "resolve" ClassDescriptors from a given class (name).

See Also:
JDOClassDescriptorResolver

Field Summary
protected  List<Class<?>> _classes
          List of manually added domain Classes.
protected  List<String> _packages
          List of manually added package names.
 
Constructor Summary
JDOClassDescriptorResolverImpl()
          Creates an instance of this class, with no classed manually added.
 
Method Summary
 void addClass(Class domainClass)
          Adds a given Class instance manually, so that it can be loaded from the file system.
 void addPackage(String packageName)
          Adds a given package name manually, so that class descriptors can be loaded from this package (from the file system).
 Iterator<ClassDescriptor> descriptorIterator()
          Returns an iterator over all the known descriptors in the original order they have been added.
 ClassLoader getClassLoader()
          Returns the ClassLoader instance as used internally.
 MappingLoader getMappingLoader()
          
 void registerDescriptor(Class type, ClassDescriptor classDescriptor)
          Registers a ClassDescriptor with the descriptor cache.
 ClassDescriptor resolve(Class type)
          Returns the ClassDescriptor for the given class using the following strategy.
 ClassDescriptor resolve(String type)
          Returns the ClassDescriptor for the given class.
 void setMappingLoader(MappingLoader mappingLoader)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_classes

protected List<Class<?>> _classes
List of manually added domain Classes.


_packages

protected List<String> _packages
List of manually added package names.

Constructor Detail

JDOClassDescriptorResolverImpl

public JDOClassDescriptorResolverImpl()
Creates an instance of this class, with no classed manually added.

Method Detail

resolve

public ClassDescriptor resolve(String type)
                        throws ResolverException
Returns the ClassDescriptor for the given class.

Specified by:
resolve in interface JDOClassDescriptorResolver
Parameters:
type - the class name to find the ClassDescriptor for
Returns:
the ClassDescriptor for the given class
Throws:
ResolverException - Indicates that the given Class cannot be resolved.

resolve

public ClassDescriptor resolve(Class type)
                        throws ResolverException
Returns the ClassDescriptor for the given class using the following strategy.

Specified by:
resolve in interface ClassDescriptorResolver
Parameters:
type - the Class to find the ClassDescriptor for
Returns:
the ClassDescriptor for the given class, null if not found
Throws:
ResolverException - Indicates that the given Class cannot be resolved.

registerDescriptor

public void registerDescriptor(Class type,
                               ClassDescriptor classDescriptor)
Registers a ClassDescriptor with the descriptor cache.

Specified by:
registerDescriptor in interface JDOClassDescriptorResolver
Parameters:
type - Type of the class described by the ClassDescriptor to register.
classDescriptor - The ClassDescriptor to register with the cache.

getMappingLoader

public MappingLoader getMappingLoader()

Specified by:
getMappingLoader in interface ClassDescriptorResolver

setMappingLoader

public void setMappingLoader(MappingLoader mappingLoader)

Specified by:
setMappingLoader in interface ClassDescriptorResolver

addClass

public void addClass(Class domainClass)
Adds a given Class instance manually, so that it can be loaded from the file system.

Specified by:
addClass in interface JDOClassDescriptorResolver
Parameters:
domainClass - A given Class instance.

addPackage

public void addPackage(String packageName)
Adds a given package name manually, so that class descriptors can be loaded from this package (from the file system).

Specified by:
addPackage in interface JDOClassDescriptorResolver
Parameters:
packageName - A given package name.

descriptorIterator

public Iterator<ClassDescriptor> descriptorIterator()
Returns an iterator over all the known descriptors in the original order they have been added. Each element is of type ClassDescriptor.

Specified by:
descriptorIterator in interface JDOClassDescriptorResolver
Returns:
an Iterator over all the known JDO class descriptors.

getClassLoader

public ClassLoader getClassLoader()
Returns the ClassLoader instance as used internally.

Specified by:
getClassLoader in interface JDOClassDescriptorResolver
Returns:
The ClassLoader instance used internally.


Copyright © 2010. All Rights Reserved.