Package org.glassfish.tyrus.core
Class ServiceFinder.ServiceIteratorProvider
java.lang.Object
org.glassfish.tyrus.core.ServiceFinder.ServiceIteratorProvider
- Direct Known Subclasses:
ServiceFinder.DefaultServiceIteratorProvider
- Enclosing class:
ServiceFinder<T>
Supports iteration of provider instances or classes.
The default implementation looks up provider classes from META-INF/services
files, see ServiceFinder.DefaultServiceIteratorProvider
.
This implementation may be overridden by invoking
ServiceFinder.setIteratorProvider(ServiceIteratorProvider)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateClassIterator
(Class<T> service, String serviceName, ClassLoader loader, boolean ignoreOnClassNotFound) Iterate over provider classes of a service.abstract <T> Iterator
<T> createIterator
(Class<T> service, String serviceName, ClassLoader loader, boolean ignoreOnClassNotFound) Iterate over provider instances of a service.
-
Constructor Details
-
ServiceIteratorProvider
public ServiceIteratorProvider()
-
-
Method Details
-
createIterator
public abstract <T> Iterator<T> createIterator(Class<T> service, String serviceName, ClassLoader loader, boolean ignoreOnClassNotFound) Iterate over provider instances of a service.- Type Parameters:
T
- the type of the service.- Parameters:
service
- the service class.serviceName
- the service name.loader
- the class loader to utilize when loading provider classes.ignoreOnClassNotFound
- if true ignore an instance if the corresponding provider class if cannot be found, otherwise throw aClassNotFoundException
.- Returns:
- the provider instance iterator.
-
createClassIterator
public abstract <T> Iterator<Class<T>> createClassIterator(Class<T> service, String serviceName, ClassLoader loader, boolean ignoreOnClassNotFound) Iterate over provider classes of a service.- Type Parameters:
T
- the type of the service.- Parameters:
service
- the service class.serviceName
- the service name.loader
- the class loader to utilize when loading provider classes.ignoreOnClassNotFound
- if true ignore the provider class if cannot be found, otherwise throw aClassNotFoundException
.- Returns:
- the provider class iterator.
-