Package org.revapi
Class ServiceTypeLoader<T>
- java.lang.Object
-
- org.revapi.ServiceTypeLoader<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 theServiceLoader
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).- Since:
- 0.8.0
- Author:
- Lukas Krejci
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<Class<? extends T>>
iterator()
static <X> ServiceTypeLoader<X>
load(Class<X> serviceType)
Locates the services in the context classloader of the current thread.static <X> ServiceTypeLoader<X>
load(Class<X> serviceType, ClassLoader cl)
void
reload()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
load
public static <X> ServiceTypeLoader<X> load(Class<X> serviceType, ClassLoader cl)
-
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- Parameters:
serviceType
- the type of the services to locate- Returns:
- the service type loader
-
reload
public void reload()
-
-