|
Algernon Software | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.algernon.util.ReflectionUtil
ReflectionUtil contains static methods that are useful when dealing with reflection and packages. User: hewett Date: Nov 25, 2003 Time: 3:38:31 PM
Constructor Summary | |
ReflectionUtil()
|
Method Summary | |
static Method |
findMethod(Method[] methods,
String name)
Finds a method with the given name from the set of methods. |
static String |
findMethodName(Method[] methods,
String name)
Finds a method with the given name from the set of methods. |
private static Object |
findPackageLocation(String pkgname)
If the package is not found, returns null. |
static Collection |
getClassesFromDirectory(String pkgname,
File directory)
Given a directory that is the root of a class hierarchy, and a package name, retrieves the Java Classes from the package in the jar file. |
static Collection |
getClassesFromJar(String pkgname,
URL url)
Given a URL specifying a jar file and a package name, retrieves the Java Classes from the package in the jar file. |
static Collection |
getClassesOfPackage(String pkgname)
Returns all Java Classes in the given package. |
static Collection |
getClassesOfPackages(Collection packages)
Returns all of the Java Classes in all of the packages presented. |
static String |
getPackageName(Class aClass)
Returns the name of the package of the class. |
static String |
getShortName(Class aClass)
Returns the short name of a Java class (without the package name). |
static boolean |
isRootClassOfItsPackage(Class aClass)
Returns true if the given class does not have a superclass in the given package. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReflectionUtil()
Method Detail |
public static boolean isRootClassOfItsPackage(Class aClass)
public static Collection getClassesOfPackages(Collection packages)
public static Collection getClassesOfPackage(String pkgname)
pkgname
-
public static Collection getClassesFromJar(String pkgname, URL url)
pkgname
- the name of the package, e.g. com.bigbiz.utilurl
- the jar location
public static Collection getClassesFromDirectory(String pkgname, File directory)
pkgname
- the name of the package, e.g. com.bigbiz.utildirectory
- the root of the class hierarchy.
File.list()
private static Object findPackageLocation(String pkgname)
pkgname
- the name of the package to find.
public static String findMethodName(Method[] methods, String name)
findMethod(java.lang.reflect.Method[], java.lang.String)
public static Method findMethod(Method[] methods, String name)
public static String getShortName(Class aClass)
aClass
- public static String getPackageName(Class aClass)
aClass
-
|
Algernon Software | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |