Class ReflectionBase
java.lang.Object
com.miketheshadow.autoregister.util.ReflectionBase
- Direct Known Subclasses:
AutoRegister
The base for all reflection utilities
If you want to have access to every file in your plugin you can extend this and use it
to create your own reflection tool
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected booleanprotected Stringprotected org.bukkit.plugin.Plugin -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis opens the jar file to basically read the contents.voidEnable debug messages.voidEnables the force loading of all classes.<A extends Annotation>
Set<Class<?>>getClassesAnnotatedWith(Class<A> annotation) Gets any class in the package annotated with annotation
-
Field Details
-
packageName
-
classes
-
plugin
protected org.bukkit.plugin.Plugin plugin -
force
protected boolean force -
debugLogging
protected boolean debugLogging -
initialPackageFound
protected boolean initialPackageFound
-
-
Constructor Details
-
ReflectionBase
public ReflectionBase()
-
-
Method Details
-
collectAllClasses
This opens the jar file to basically read the contents. I can't imagine the jar is ever unreadable, but you never know these days. To get all the current packages usegetClasses()- Returns:
- All the classes within the package.
-
getClassesAnnotatedWith
Gets any class in the package annotated with annotation- Type Parameters:
A- Specifies the class is an annotation.- Parameters:
annotation- The annotation to filter the classes by.- Returns:
- All classes annotated with the parameter.
-
debugLog
-
error
-
enableDebugMessages
Enable debug messages. Currently, the names of everything registered and the sizes/amounts of classes loaded are all that is logged.- Returns:
- The instance of
AutoRegister.
-
forceLoadAllClasses
Enables the force loading of all classes. In some circumstances it's possible for things to not work as intended. force loading all classes will create a more significant delay on the speed of loading and should only be used if listeners are not registering properly.- Returns:
- The instance of
AutoRegister.
-
getClasses
- Returns:
- a set of every class in your project.
-