Class ExtendedServiceLoader

java.lang.Object
com.sap.cds.services.runtime.ExtendedServiceLoader

public class ExtendedServiceLoader extends Object
Loads implementations of classes via Java's ServiceLoader and provides the CdsRuntime to these if requested through the CdsRuntimeAware interface.
  • Constructor Details

    • ExtendedServiceLoader

      public ExtendedServiceLoader()
  • Method Details

    • loadAll

      public static <T> Iterator<T> loadAll(Class<T> clazz)
      Loads all implementations of the given class. The loaded implementations may NOT request the CdsRuntime through CdsRuntimeAware.
      Type Parameters:
      T - the type
      Parameters:
      clazz - the class
      Returns:
      the implementations
    • loadAll

      public static <T> Iterator<T> loadAll(Class<T> clazz, CdsRuntime runtime)
      Loads all implementations of the given class. The loaded implementations may request the CdsRuntime through CdsRuntimeAware.
      Type Parameters:
      T - the type
      Parameters:
      clazz - the class
      runtime - the CdsRuntime
      Returns:
      the implementations, initialized with the CdsRuntime
    • loadSingle

      public static <T> T loadSingle(Class<T> clazz)
      Loads the first implementation of the given class. The loaded implementation may NOT request the CdsRuntime through CdsRuntimeAware.
      Type Parameters:
      T - the type
      Parameters:
      clazz - the class
      Returns:
      the implementation
    • loadSingle

      public static <T> T loadSingle(Class<T> clazz, CdsRuntime runtime)
      Loads the first implementation of the given class. The loaded implementation may request the CdsRuntime through CdsRuntimeAware.
      Type Parameters:
      T - the type
      Parameters:
      clazz - the class
      runtime - the CdsRuntime
      Returns:
      the implementation, initialized with the CdsRuntime