Class ModuleProvider

java.lang.Object
com.github.cafapi.common.util.moduleloader.ModuleProvider

public final class ModuleProvider extends Object
Allows retrieval of a module based on the Interface that it implements and its simple name.
  • Method Details

    • getInstance

      public static ModuleProvider getInstance()
    • getModule

      public <T> T getModule(Class<T> interfaceImplemented, String moduleType) throws NullPointerException
      Retrieves a module by its simple name, that implements a particular type T
      Parameters:
      interfaceImplemented - The interface that 'moduleType' implements and that the result should be returned as.
      moduleType - Represents particular instance of a factory type object e.g. 'ExampleWorkerBuilder'
      Returns:
      An instance of moduleType as the type T passed in.
      Throws:
      NullPointerException - If the module cannot be retrieved with the specified moduleType.