Class ServiceLoaderUtility

java.lang.Object
com.nimbusds.common.spi.ServiceLoaderUtility

public class ServiceLoaderUtility extends Object
Service (SPI) loader utility.
  • Constructor Details

  • Method Details

    • loadSingle

      public static <T> T loadSingle(Class<T> tClass, T defaultImpl)
      Loads a single Service Provider Interface (SPI) implementation.
      Parameters:
      tClass - The SPI. Not null.
      defaultImpl - The default implementation, null if not specified.
      Returns:
      The loaded SPI implementation or the default one.
      Throws:
      RuntimeException - If more than one SPI implementation was found.
    • loadMultiple

      public static <T> Set<T> loadMultiple(Class<T> tClass, T defaultImpl)
      Loads multiple Service Provider Interface (SPI) implementations.
      Parameters:
      tClass - The SPI. Not null.
      defaultImpl - The default implementation, null if not specified.
      Returns:
      The loaded SPI implementations, if none were loaded and a default was specified, a singleton set with it.