Package mondrian.util
Class ClassResolver.AbstractClassResolver
- java.lang.Object
-
- mondrian.util.ClassResolver.AbstractClassResolver
-
- All Implemented Interfaces:
ClassResolver
- Direct Known Subclasses:
ClassResolver.ThreadContextClassResolver
- Enclosing interface:
- ClassResolver
public abstract static class ClassResolver.AbstractClassResolver extends Object implements ClassResolver
Partial implementation ofClassResolver
. Derived class just needs to implementgetClassLoader()
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface mondrian.util.ClassResolver
ClassResolver.AbstractClassResolver, ClassResolver.ThreadContextClassResolver
-
-
Field Summary
-
Fields inherited from interface mondrian.util.ClassResolver
INSTANCE
-
-
Constructor Summary
Constructors Constructor Description AbstractClassResolver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T> Class<T>
forName(String className, boolean initialize)
Equivalent ofClass.forName(String, boolean, ClassLoader)
.protected abstract ClassLoader
getClassLoader()
Returns the class loader to use for the current operation.protected ClassLoader
getClassLoaderNotNull()
Returns the class loader to use for the current operation, never null.Iterable<URL>
getResources(String name)
Equivalent ofClassLoader.getResources(String)
.<T> T
instantiateSafe(String className, Object... args)
Instantiates a class and constructs an instance using the given arguments.
-
-
-
Method Detail
-
instantiateSafe
public <T> T instantiateSafe(String className, Object... args)
Description copied from interface:ClassResolver
Instantiates a class and constructs an instance using the given arguments.- Specified by:
instantiateSafe
in interfaceClassResolver
- Type Parameters:
T
- Desired type- Parameters:
className
- Class nameargs
- Arguments
-
forName
public <T> Class<T> forName(String className, boolean initialize) throws ClassNotFoundException
Description copied from interface:ClassResolver
Equivalent ofClass.forName(String, boolean, ClassLoader)
.- Specified by:
forName
in interfaceClassResolver
- Throws:
ClassNotFoundException
-
getClassLoader
protected abstract ClassLoader getClassLoader()
Returns the class loader to use for the current operation. May be null.
-
getClassLoaderNotNull
protected ClassLoader getClassLoaderNotNull()
Returns the class loader to use for the current operation, never null.
-
getResources
public Iterable<URL> getResources(String name) throws IOException
Description copied from interface:ClassResolver
Equivalent ofClassLoader.getResources(String)
.- Specified by:
getResources
in interfaceClassResolver
- Throws:
IOException
-
-