Package org.revapi

Class ServiceTypeLoader<T>

  • All Implemented Interfaces:
    Iterable<Class<? extends T>>

    public final class ServiceTypeLoader<T>
    extends Object
    implements Iterable<Class<? extends T>>
    Because Revapi manages the lifecycle of instances of its extensions, it cannot unfortunately use the ServiceLoader directly (before Java 9 which enhances it to support the use case Revapi needs).

    This class is similar to ServiceLoader but instead of providing instances of the service implementations, it provides types of the service implementations. Users of this class are then responsible for using these types anyway they want (instantiate them or whatever).

    Lukas Krejci
    • Method Detail

      • load

        public static <X> ServiceTypeLoader<X> load​(Class<X> serviceType)
        Locates the services in the context classloader of the current thread.
        Type Parameters:
        X - the type of the service
        serviceType - the type of the services to locate
        the service type loader
      • reload

        public void reload()