Class ReflectionUtility
java.lang.Object
org.gcube.informationsystem.utils.ReflectionUtility
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 -
Method Summary
Modifier and TypeMethodDescriptiongetClassesForPackage(Package packageObject) Attempts to list all the classes in the specified package as determined by the context class loadergetClassesForPackage(String pckgname) Attempts to list all the classes in the specified package as determined by the context class loader
-
Constructor Details
-
ReflectionUtility
public ReflectionUtility()
-
-
Method Details
-
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
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
-