类 ServiceHelper

java.lang.Object
com.ajaxjs.mcp.message.ServiceHelper

public class ServiceHelper extends Object
Utility wrapper around ServiceLoader.load().
  • 方法详细资料

    • loadFactories

      public static <T> Collection<T> loadFactories(Class<T> clazz)
      Load all the services of a given type.
      类型参数:
      T - the type of service
      参数:
      clazz - the type of service
      返回:
      the list of services, empty if none
    • loadFactories

      public static <T> Collection<T> loadFactories(Class<T> clazz, ClassLoader classLoader)
      Load all the services of a given type.

      Utility mechanism around ServiceLoader.load()

      • If classloader is null, will try ServiceLoader.load(clazz)
      • If classloader is not null, will try ServiceLoader.load(clazz, classloader)

      If the above return nothing, will fall back to ServiceLoader.load(clazz, $this class loader$)

      类型参数:
      T - the type of service
      参数:
      clazz - the type of service
      classLoader - the classloader to use, may be null
      返回:
      the list of services, empty if none