public class ClassPathUtil extends Object
Constructor and Description |
---|
ClassPathUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
classForName(String preferredClassName,
Class<? extends T> defaultClass,
Class<T> sharedClassOrInterface,
ClassLoader classLoader)
Return an instance of the shared interface.
|
static <T> T |
classForName(String preferredClassName,
Class<T> defaultClass,
Class<T> sharedInterface) |
public static <T> T classForName(String preferredClassName, Class<T> defaultClass, Class<T> sharedInterface)
public static <T> T classForName(String preferredClassName, Class<? extends T> defaultClass, Class<T> sharedClassOrInterface, ClassLoader classLoader)
preferredClassName
- The name of the preferred class to use. The class may need to
have a zero argument public constructor in order to be
instantiated by this this method.defaultClass
- The default class to use (optional). When non-
null
, the default class must implement the shared
interface.sharedClassOrInterface
- A class or interface that the preferred class must implement
if it is to be instantiated.classLoader
- The class loader to use.null
.IllegalArgumentException
- if the preferred class name is null
.IllegalArgumentException
- if defaultClass is given and does not implement the shared
interface.RuntimeException
- if an attempt to instantiate the default class results in a
SecurityException
or IllegalAccessException
.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.