Class ReflectionBase

java.lang.Object
com.miketheshadow.autoregister.util.ReflectionBase
Direct Known Subclasses:
AutoRegister

public class ReflectionBase extends Object
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 Details

    • packageName

      protected String packageName
    • classes

      protected Set<Class<?>> 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

      protected Set<Class<?>> 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 use getClasses()
      Returns:
      All the classes within the package.
    • getClassesAnnotatedWith

      public <A extends Annotation> Set<Class<?>> getClassesAnnotatedWith(Class<A> annotation)
      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

      public void debugLog(String message)
    • error

      public void error(String message)
    • enableDebugMessages

      public ReflectionBase 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

      public ReflectionBase forceLoadAllClasses()
    • getClasses

      public Set<Class<?>> getClasses()
      Returns:
      a set of every class in your project.