Package kos.api

Class ImplementationLoader.SPIImplementationLoader

java.lang.Object
kos.api.ImplementationLoader.SPIImplementationLoader
All Implemented Interfaces:
ImplementationLoader
Enclosing interface:
ImplementationLoader

public static class ImplementationLoader.SPIImplementationLoader extends Object implements ImplementationLoader
  • Field Details

  • Constructor Details

    • SPIImplementationLoader

      public SPIImplementationLoader()
  • Method Details

    • instancesExposedAs

      public <T> Iterable<T> instancesExposedAs(Class<T> interfaceType)
      Description copied from interface: ImplementationLoader
      Loads classes exposed by the given interfaceType.
      Specified by:
      instancesExposedAs in interface ImplementationLoader
      Type Parameters:
      T - same type as interfaceType
      Parameters:
      interfaceType - an abstract class or interface in which concrete implementations is expected to be loaded
      Returns:
      found implementations or empty Iterable if none was found.
    • instanceOf

      public <T> ImplementationLoader.Result<T> instanceOf(Class<T> type)
      Description copied from interface: ImplementationLoader
      Load the instance of the given type.
      Specified by:
      instanceOf in interface ImplementationLoader
      Type Parameters:
      T - same type as type
      Parameters:
      type - expected class to be loaded.
      Returns:
      an Optional instance containing or not the found instance.
    • register

      public <T> void register(Class<T> type, T instance)
      Specified by:
      register in interface ImplementationLoader