Package xyz.dynxsty.dih4jda.util
Class ClassWalker
java.lang.Object
xyz.dynxsty.dih4jda.util.ClassWalker
A class that provides you with the ability to get all classes inside a specific package.
- Since:
- v1.6
-
Constructor Summary
ConstructorDescriptionClassWalker
(String packageName) Creates a new instance that allows you to perform reflective operations for the defined package. -
Method Summary
Modifier and TypeMethodDescriptionGets all classes inside the given package and sub packages.getSubTypesOf
(Class<T> type) Gets all classes in the given package and sub packages which extend the specified class.
-
Constructor Details
-
ClassWalker
Creates a new instance that allows you to perform reflective operations for the defined package.- Parameters:
packageName
- the package you want to perform operations on.
-
-
Method Details
-
getAllClasses
Gets all classes inside the given package and sub packages.- Returns:
- An unmodifiable
Set
of classes inside the given package. - Throws:
DIH4JDAException
- is thrown if anything happens during this reflection operation.- Since:
- v1.6
-
getSubTypesOf
@Nonnull public <T> Set<Class<? extends T>> getSubTypesOf(@Nonnull Class<T> type) throws DIH4JDAException Gets all classes in the given package and sub packages which extend the specified class.- Type Parameters:
T
- the instance of the class that was provided as a type.- Parameters:
type
- The parent class to search for.- Returns:
- an unmodifiable
Set
of classes which are assignable to the given type. - Throws:
DIH4JDAException
- is thrown bygetAllClasses()
.- Since:
- v1.6
-