|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.discovery.tools.ClassUtils
public class ClassUtils
Various utilities to interact with Class types.
| Constructor Summary | |
|---|---|
ClassUtils()
|
|
| Method Summary | ||
|---|---|---|
static java.lang.reflect.Method |
findPublicStaticMethod(java.lang.Class<?> clazz,
java.lang.Class<?> returnType,
java.lang.String methodName,
java.lang.Class<?>[] paramTypes)
Looks for public static returnType methodName(paramTypes). |
|
static java.lang.String |
getPackageName(java.lang.Class<?> clazz)
Get package name. |
|
static
|
newInstance(java.lang.Class<T> impl,
java.lang.Class<?>[] paramClasses,
java.lang.Object[] params)
Creates a new instance of the input class using the following policy: if paramClasses or params is null,
the default constructor will be used;
the public constructor with paramClasses arguments type,
with params as arguments value, will be used.
|
|
static void |
setLog(org.apache.commons.logging.Log _log)
Deprecated. This method is not thread-safe |
|
static void |
verifyAncestory(java.lang.Class<?> spi,
java.lang.Class<?> impl)
Throws exception if impl does not
implement or extend the SPI. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassUtils()
| Method Detail |
|---|
@Deprecated public static void setLog(org.apache.commons.logging.Log _log)
Log for this class.
_log - This class Logpublic static java.lang.String getPackageName(java.lang.Class<?> clazz)
clazz - The class from which the package has to be extracted
public static java.lang.reflect.Method findPublicStaticMethod(java.lang.Class<?> clazz,
java.lang.Class<?> returnType,
java.lang.String methodName,
java.lang.Class<?>[] paramTypes)
public static returnType methodName(paramTypes).
clazz - The class where looking for the methodreturnType - The method return typemethodName - The method nameparamTypes - The method arguments types
public static returnType methodName(paramTypes),
if found to be directly implemented by clazz.
public static <T> T newInstance(java.lang.Class<T> impl,
java.lang.Class<?>[] paramClasses,
java.lang.Object[] params)
throws DiscoveryException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException
paramClasses or params is null,
the default constructor will be used;paramClasses arguments type,
with params as arguments value, will be used.
T - The class type has to be instantiatedimpl - The class has to be instantiatedparamClasses - The constructor arguments types (can be null)params - The constructor arguments values (can be null)
DiscoveryException - if the class implementing
the SPI cannot be found, cannot be loaded and
instantiated, or if the resulting class does not implement
(or extend) the SPI
java.lang.InstantiationException - see Class.newInstance()
java.lang.IllegalAccessException - see Class.newInstance()
java.lang.NoSuchMethodException - see Class.newInstance()
java.lang.reflect.InvocationTargetException - see Class.newInstance()
public static void verifyAncestory(java.lang.Class<?> spi,
java.lang.Class<?> impl)
throws DiscoveryException
impl does not
implement or extend the SPI.
spi - The SPI typeimpl - The class has to be verified is a SPI implementation/extension
DiscoveryException - if the input implementation class is not an SPI implementation
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||