org.apache.commons.discovery.tools

Class ClassUtils

public class ClassUtils extends Object

Author: Richard A. Sitze

Method Summary
static MethodfindPublicStaticMethod(Class clazz, Class returnType, String methodName, Class[] paramTypes)
static StringgetPackageName(Class clazz)
Get package name.
static ObjectnewInstance(Class impl, Class[] paramClasses, Object[] params)
Instantiate a new
static voidsetLog(Log _log)
static voidverifyAncestory(Class spi, Class impl)
Throws exception if impl does not implement or extend the SPI.

Method Detail

findPublicStaticMethod

public static Method findPublicStaticMethod(Class clazz, Class returnType, String methodName, Class[] paramTypes)

Returns: Method 'public static returnType methodName(paramTypes)', if found to be directly implemented by clazz.

getPackageName

public static String getPackageName(Class clazz)
Get package name. Not all class loaders 'keep' package information, in which case Class.getPackage() returns null. This means that calling Class.getPackage().getName() is unreliable at best.

newInstance

public static Object newInstance(Class impl, Class[] paramClasses, Object[] params)
Instantiate a new

setLog

public static void setLog(Log _log)

verifyAncestory

public static void verifyAncestory(Class spi, Class impl)
Throws exception if impl does not implement or extend the SPI.
Copyright (c) 2002 - Apache Software Foundation