Class AbstractHookManager<H>

java.lang.Object
de.themoep.hook.core.AbstractHookManager<H>
Direct Known Subclasses:
HookManager, HookManager, HookManager

public abstract class AbstractHookManager<H> extends Object
  • Constructor Details

    • AbstractHookManager

      public AbstractHookManager(String hookPackage)
      Construct the manager
      Parameters:
      hookPackage - The package the hooks are in
    • AbstractHookManager

      public AbstractHookManager(Logger logger, String hookPackage)
      Construct the manager
      Parameters:
      logger - The custom logger that should be used for errors
      hookPackage - The package the hooks are in
    • AbstractHookManager

      public AbstractHookManager(Logger logger, String hookPackage, boolean onePackagePerHook)
      Construct the manager
      Parameters:
      logger - The custom logger that should be used for errors
      hookPackage - The package the hooks are in
      onePackagePerHook - Whether each hook should have its own package named after the hook or not Defaults to false
  • Method Details

    • registerExistingHookables

      protected void registerExistingHookables()
    • getHook

      public Hook<H> getHook(H hookable)
      Get the Hook from a Hookable
      Parameters:
      hookable - The hookable to get the hook for
      Returns:
      The hook or null
    • getHook

      public Hook<H> getHook(String hookable)
      Get the Hook from the name of a Hookable
      Parameters:
      hookable - The name of the hookable to get the hook for
      Returns:
      The hook or null
    • getSuffix

      public String getSuffix()
      Get the suffix to append to the class name when searching for a hook.
      Returns:
      The hook class suffix; defaults to "Hook"
    • setSuffix

      public void setSuffix(String suffix)
      Set the suffix to append to the class name when searching for a hook.
      Parameters:
      suffix - The hook class suffix; defaults to "Hook"
    • onHookableEnable

      protected void onHookableEnable(H hookable)
    • onHookableDisable

      protected void onHookableDisable(H hookable)
    • getNames

      protected String[] getNames(H hookable)
    • getName

      protected abstract String getName(H hookable)
    • getVersion

      protected abstract String getVersion(H hookable)
    • isEnabled

      protected abstract boolean isEnabled(H hookable)
    • getHookables

      protected abstract Collection<H> getHookables()