Package mondrian.util
Interface ClassResolver
-
- All Known Implementing Classes:
ClassResolver.AbstractClassResolver
,ClassResolver.ThreadContextClassResolver
public interface ClassResolver
Instantiates a class.Has same effect as calling
Class.forName(String)
, but uses the appropriateClassLoader
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ClassResolver.AbstractClassResolver
Partial implementation ofClassResolver
.static class
ClassResolver.ThreadContextClassResolver
Implementation ofClassResolver
that callsThread.getContextClassLoader()
on the current thread.
-
Field Summary
Fields Modifier and Type Field Description static ClassResolver
INSTANCE
Default resolver.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Class<T>
forName(String className, boolean initialize)
Equivalent ofClass.forName(String, boolean, ClassLoader)
.Iterable<URL>
getResources(String lookupName)
Equivalent ofClassLoader.getResources(String)
.<T> T
instantiateSafe(String className, Object... args)
Instantiates a class and constructs an instance using the given arguments.
-
-
-
Field Detail
-
INSTANCE
static final ClassResolver INSTANCE
Default resolver.
-
-
Method Detail
-
forName
<T> Class<T> forName(String className, boolean initialize) throws ClassNotFoundException
Equivalent ofClass.forName(String, boolean, ClassLoader)
.- Throws:
ClassNotFoundException
-
instantiateSafe
<T> T instantiateSafe(String className, Object... args)
Instantiates a class and constructs an instance using the given arguments.- Type Parameters:
T
- Desired type- Parameters:
className
- Class nameargs
- Arguments- Throws:
ClassCastException
- if resulting object is not an instance of T
-
getResources
Iterable<URL> getResources(String lookupName) throws IOException
Equivalent ofClassLoader.getResources(String)
.- Throws:
IOException
-
-