Interface ModuleController


public interface ModuleController
Owns the module tree. It switches modules on and off, keeps the parent-child links, and answers whether a module currently applies to a given entity.
  • Field Details

  • Method Details

    • collectModuleStatuses

      Map<String,String> collectModuleStatuses()
      The on/off state of every module, keyed by name, for the status command.
      Returns:
      the module states
    • collectModuleStatuses

      Map<String,String> collectModuleStatuses(Class<? extends ModuleSimple> clazz)
      The on/off state of one module and everything under it.
      Parameters:
      clazz - the module to start from
      Returns:
      the module states
    • isEnable

      boolean isEnable(ModuleSimple abstractModule)
      Whether a module is switched on.
      Parameters:
      abstractModule - the module
      Returns:
      true if it is enabled
    • isEnable

      boolean isEnable(ModuleName moduleName)
      Whether a module is switched on, looked up by name.
      Parameters:
      moduleName - the module name
      Returns:
      true if it is enabled
    • containsChild

      boolean containsChild(ModuleSimple module, ModuleName moduleName)
      Whether a module has the named module somewhere beneath it.
      Parameters:
      module - the parent module
      moduleName - the child name to look for
      Returns:
      true if the child is nested under the parent
    • isDisabledFor

      boolean isDisabledFor(ModuleSimple module, FEntity fEntity)
      Whether a module does not apply to an entity, taking the config, the permission and the module's own extra condition into account.
      Parameters:
      module - the module
      fEntity - the entity
      Returns:
      true if the module is off for this entity
    • isDisabledFor

      boolean isDisabledFor(ModuleSimple module, FEntity fEntity, boolean checkLocalizationModule)
      Whether a module does not apply to an entity, optionally also requiring its text to be available.
      Parameters:
      module - the module
      fEntity - the entity
      checkLocalizationModule - whether a missing localization also counts as disabled
      Returns:
      true if the module is off for this entity
    • terminate

      void terminate()
      Switches every module off, deepest first.
    • disable

      void disable(ModuleSimple module)
      Switches one module and everything under it off.
      Parameters:
      module - the module to disable
    • initialize

      void initialize()
      Builds the module tree and switches on everything the config enables.
    • enable

      void enable(ModuleSimple module, Predicate<ModuleSimple> enablePredicate)
      Switches a module on, then walks its children and enables those the test accepts.
      Parameters:
      module - the module to enable
      enablePredicate - decides whether a given child is enabled too
    • isInstanceOfAny

      boolean isInstanceOfAny(ModuleSimple module, Set<Class<? extends ModuleSimple>> classes)
      Whether a module is one of the given types, used with the grouped constants above.
      Parameters:
      module - the module
      classes - the types to test against
      Returns:
      true if the module matches any of them