public abstract class ClassLoaderResolver
extends java.lang.Object
ResourceLoader,
IClassLoadStrategy,
ClassLoaderResolver.DefaultClassLoadStrategy| Modifier and Type | Class and Description |
|---|---|
private static class |
ClassLoaderResolver.CallerResolver
A helper class to get the call context.
|
private static class |
ClassLoaderResolver.DefaultClassLoadStrategy |
| Modifier and Type | Field and Description |
|---|---|
private static int |
CALL_CONTEXT_OFFSET |
private static ClassLoaderResolver.CallerResolver |
CALLER_RESOLVER |
private static IClassLoadStrategy |
s_strategy |
| Modifier | Constructor and Description |
|---|---|
private |
ClassLoaderResolver() |
| Modifier and Type | Method and Description |
|---|---|
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(). |
private static IClassLoadStrategy s_strategy
private static final int CALL_CONTEXT_OFFSET
private static final ClassLoaderResolver.CallerResolver CALLER_RESOLVER
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]