|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.triactive.jdo.util.ClassFinder
Used to load classes according to the rules defined in the JDO spec. See section 12.5 of the JDO 1.0.1 spec.
This class also provides a static method
for loading classes that utilizes a cache.
The cache contains class names that were previously not found,
organized by the loader that failed to find them.
This speeds up cases where attempts to load the same non-existent class are
repeated many times.
Method Summary | |
java.lang.Class |
classForName(java.lang.String className,
boolean initialize)
Returns the Class object associated with the class or interface with the given string name. |
java.lang.Class |
classForName(java.lang.String className,
boolean initialize,
java.lang.Class contextClass)
Returns the Class object associated with the class or interface with the given string name. |
static java.lang.Class |
classForName(java.lang.String className,
boolean initialize,
java.lang.ClassLoader loader)
Returns the Class object associated with the class or interface with the given string name. |
boolean |
equals(java.lang.Object obj)
Indicates whether some object is "equal to" this one. |
static ClassFinder |
getInstance()
Returns the class finder instance associated with the context class loader of the calling thread. |
static ClassFinder |
getInstance(java.lang.ClassLoader ctxLoader)
Returns the class finder instance associated with the specified class loader. |
int |
hashCode()
Returns a hash code value for this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static ClassFinder getInstance()
public static ClassFinder getInstance(java.lang.ClassLoader ctxLoader)
classForName(String,boolean,Class)
.
ctxLoader
- the context class loaderpublic java.lang.Class classForName(java.lang.String className, boolean initialize, java.lang.Class contextClass) throws java.lang.ClassNotFoundException
This method implements the algorithm described in section 12.5 of the JDO 1.0.1 spec. It attempts to load the class using up to three loaders:
className
- fully qualified name of the desired classinitialize
- whether the class must be initializedcontextClass
- another class to serve as context for the loading of the named
class, or null
if there is no such other class
java.lang.ClassNotFoundException
- if the class cannot be locatedpublic java.lang.Class classForName(java.lang.String className, boolean initialize) throws java.lang.ClassNotFoundException
This method is equivalent to:
classForName(className, initialize, null)
className
- fully qualified name of the desired classinitialize
- whether the class must be initialized
java.lang.ClassNotFoundException
- if the class cannot be locatedpublic static java.lang.Class classForName(java.lang.String className, boolean initialize, java.lang.ClassLoader loader) throws java.lang.ClassNotFoundException
This method is functionally equivalent to
Class.forName(String,boolean,ClassLoader)
except that it maintains a cache of class names that are not
found.
In many cases, especially in an app server environment, searching for
non-existent classes can be a slow process.
It's important because some things in TJDO, notably the macro mechanism
used in e.g. view definitions, will search for class names that don't
exist.
className
- fully qualified name of the desired classinitialize
- whether the class must be initializedloader
- class loader from which the class must be loaded
java.lang.ClassNotFoundException
- if the class cannot be locatedpublic int hashCode()
public boolean equals(java.lang.Object obj)
obj
- the reference object with which to compare
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |