Class ReflectionUtility
- java.lang.Object
-
- org.gcube.informationsystem.utils.ReflectionUtility
-
public class ReflectionUtility extends Object
A utility class for finding all classes within a given package.This implementation is based on the solution provided at Stack Overflow.
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Constructor Summary
Constructors Constructor Description ReflectionUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Class<?>>getClassesForPackage(Package packageObject)Attempts to list all the classes in the specified package as determined by the context class loaderstatic List<Class<?>>getClassesForPackage(String pckgname)Attempts to list all the classes in the specified package as determined by the context class loader
-
-
-
Method Detail
-
getClassesForPackage
public static List<Class<?>> getClassesForPackage(Package packageObject) throws ClassNotFoundException
Attempts to list all the classes in the specified package as determined by the context class loader- Parameters:
packageObject- the package to search- Returns:
- a list of classes that exist within that package
- Throws:
ClassNotFoundException- if something went wrong
-
getClassesForPackage
public static List<Class<?>> getClassesForPackage(String pckgname) throws ClassNotFoundException
Attempts to list all the classes in the specified package as determined by the context class loader- Parameters:
pckgname- the package name to search- Returns:
- a list of classes that exist within that package
- Throws:
ClassNotFoundException- if something went wrong
-
-