|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vladium.util.ClassLoaderResolver
public abstract class ClassLoaderResolver
This non-instantiable non-subclassable class acts as the global point for choosing a ClassLoader for dynamic class/resource loading at any point in an application.
ResourceLoader
,
IClassLoadStrategy
,
ClassLoaderResolver.DefaultClassLoadStrategy
Nested Class Summary | |
---|---|
private static class |
ClassLoaderResolver.CallerResolver
A helper class to get the call context. |
private static class |
ClassLoaderResolver.DefaultClassLoadStrategy
|
Field Summary | |
---|---|
private static int |
CALL_CONTEXT_OFFSET
|
private static ClassLoaderResolver.CallerResolver |
CALLER_RESOLVER
|
private static IClassLoadStrategy |
s_strategy
|
Constructor Summary | |
---|---|
private |
ClassLoaderResolver()
|
Method Summary | |
---|---|
static java.lang.Class |
getCallerClass(int callerOffset)
|
static java.lang.ClassLoader |
getClassLoader()
This method selects the "best" classloader instance to be used for class/resource loading by whoever calls this method. |
static java.lang.ClassLoader |
getClassLoader(java.lang.Class caller)
This method selects the "best" classloader instance to be used for class/resource loading by whoever calls this method. |
static IClassLoadStrategy |
getStrategy()
Gets the current classloader selection strategy setting. |
static boolean |
isChild(java.lang.ClassLoader loader1,
java.lang.ClassLoader loader2)
Returns 'true' if 'loader2' is a delegation child of 'loader1' [or if 'loader1'=='loader2']. |
static IClassLoadStrategy |
setStrategy(IClassLoadStrategy strategy)
Sets the classloader selection strategy to be used by subsequent calls to getClassLoader() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static IClassLoadStrategy s_strategy
private static final int CALL_CONTEXT_OFFSET
private static final ClassLoaderResolver.CallerResolver CALLER_RESOLVER
Constructor Detail |
---|
private ClassLoaderResolver()
Method Detail |
---|
public static java.lang.ClassLoader getClassLoader(java.lang.Class caller)
IClassLoadStrategy
instance established by the last call to setStrategy(com.vladium.util.IClassLoadStrategy)
.This method does not throw.
caller
- [null input eliminates the caller's current classloader
from consideration]
public static java.lang.ClassLoader getClassLoader()
IClassLoadStrategy
instance established by the last call to setStrategy(com.vladium.util.IClassLoadStrategy)
.
This method uses its own caller to set the call context. To be able to
override this decision explicitly, use getClassLoader(Class)
.
This method does not throw.
public static java.lang.Class getCallerClass(int callerOffset)
public static boolean isChild(java.lang.ClassLoader loader1, java.lang.ClassLoader loader2)
public static IClassLoadStrategy getStrategy()
public static IClassLoadStrategy setStrategy(IClassLoadStrategy strategy)
getClassLoader()
. An instance of ClassLoaderResolver.DefaultClassLoadStrategy
is in effect if this method is never called.
strategy
- new strategy [may not be null]
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |