Package org.castor.cpa.util
Class JDOClassDescriptorResolverImpl
- java.lang.Object
-
- org.castor.cpa.util.JDOClassDescriptorResolverImpl
-
- All Implemented Interfaces:
JDOClassDescriptorResolver,ClassDescriptorResolver
public class JDOClassDescriptorResolverImpl extends java.lang.Object implements JDOClassDescriptorResolver
JDO-specificClassDescriptorResolverinstance that provides functionality to find or "resolve"ClassDescriptors from a given class (name).- See Also:
JDOClassDescriptorResolver
-
-
Constructor Summary
Constructors Constructor Description JDOClassDescriptorResolverImpl()Creates an instance of this class, with no classed manually added.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClass(java.lang.Class<?> domainClass)Adds a givenClassinstance manually, so that it can be loaded from the file system.voidaddPackage(java.lang.String packageName)Adds a given package name manually, so that class descriptors can be loaded from this package (from the file system).java.util.Iterator<ClassDescriptor>descriptorIterator()Returns an iterator over all the known descriptors in the original order they have been added.java.lang.ClassLoadergetClassLoader()Returns theClassLoaderinstance as used internally.MappingLoadergetMappingLoader()Note: This method will be removed soon (kv).voidregisterDescriptor(java.lang.Class<?> type, ClassDescriptor classDescriptor)Registers aClassDescriptorwith the descriptor cache.ClassDescriptorresolve(java.lang.Class<?> type)Returns the ClassDescriptor for the given class using the following strategy.
Lookup the class descriptor cache CallClassResolutionByMappingLoadercommand CallClassResolutionByFilecommandClassDescriptorresolve(java.lang.String type)Returns the ClassDescriptor for the given class.voidsetMappingLoader(MappingLoader mappingLoader)Sets the mapping loader for this ClassDescriptorResolver.
-
-
-
Method Detail
-
resolve
public ClassDescriptor resolve(java.lang.String type) throws ResolverException
Returns the ClassDescriptor for the given class.- Specified by:
resolvein interfaceJDOClassDescriptorResolver- Parameters:
type- the class name to find the ClassDescriptor for- Returns:
- the ClassDescriptor for the given class
- Throws:
ResolverException- Indicates that the givenClasscannot be resolved.
-
resolve
public ClassDescriptor resolve(java.lang.Class<?> type) throws ResolverException
Returns the ClassDescriptor for the given class using the following strategy.
- Lookup the class descriptor cache
- Call
ClassResolutionByMappingLoadercommand - Call
ClassResolutionByFilecommand
- Specified by:
resolvein interfaceClassDescriptorResolver- 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 givenClasscannot be resolved.
-
registerDescriptor
public void registerDescriptor(java.lang.Class<?> type, ClassDescriptor classDescriptor)Registers aClassDescriptorwith the descriptor cache.- Specified by:
registerDescriptorin interfaceJDOClassDescriptorResolver- Parameters:
type- Type of the class described by theClassDescriptorto register.classDescriptor- TheClassDescriptorto register with the cache.
-
getMappingLoader
public MappingLoader getMappingLoader()
Note: This method will be removed soon (kv).- Specified by:
getMappingLoaderin interfaceClassDescriptorResolver
-
setMappingLoader
public void setMappingLoader(MappingLoader mappingLoader)
Sets the mapping loader for this ClassDescriptorResolver. Note: This method will be removed soon (kv).- Specified by:
setMappingLoaderin interfaceClassDescriptorResolver
-
addClass
public void addClass(java.lang.Class<?> domainClass)
Adds a givenClassinstance manually, so that it can be loaded from the file system.- Specified by:
addClassin interfaceJDOClassDescriptorResolver- Parameters:
domainClass- A givenClassinstance.
-
addPackage
public void addPackage(java.lang.String packageName)
Adds a given package name manually, so that class descriptors can be loaded from this package (from the file system).- Specified by:
addPackagein interfaceJDOClassDescriptorResolver- Parameters:
packageName- A given package name.
-
descriptorIterator
public java.util.Iterator<ClassDescriptor> descriptorIterator()
Returns an iterator over all the known descriptors in the original order they have been added. Each element is of typeClassDescriptor.- Specified by:
descriptorIteratorin interfaceJDOClassDescriptorResolver- Returns:
- an
Iteratorover all the known JDO class descriptors.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Returns theClassLoaderinstance as used internally.- Specified by:
getClassLoaderin interfaceJDOClassDescriptorResolver- Returns:
- The
ClassLoaderinstance used internally.
-
-