public class Services extends Object implements Iterable<RepositoryService>
RepositoryServices.
Services can be explicitly added to the collection (cf. add(RepositoryService...), or else discovered on the
classpath through the standard ServiceLoader mechanism (cf. load()).
Services must be uniquely named and are overwritten by others with the same name which are subsequently added or loaded.
This class is not thread-safe. If any, synchronisation requirements fall on clients.
RepositoryService,
ServiceLoader| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
Services()
Creates an instance with no
RepositoryServices. |
Services(RepositoryService... services)
Creates an instance with given
RepositoryServices. |
| Modifier and Type | Method and Description |
|---|---|
int |
add(RepositoryService... services)
Adds one or more
RepositoryServices to this collection, overwriting those that have the same names. |
boolean |
contains(QName name)
Returns
true if this collection includes a given RepositoryService. |
Iterator<RepositoryService> |
iterator()
Returns the
RepositoryServices in this collection. |
void |
load()
Adds to this collection all the
RepositoryServices found in the classpath by a ServiceLoader. |
RepositoryService |
lookup(QName name)
Returns a
RepositoryService in this collection. |
int |
size()
Returns the number of
RepositoryServices in this collection. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic Services()
RepositoryServices.public Services(RepositoryService... services)
RepositoryServices.services - the servicespublic int add(RepositoryService... services)
RepositoryServices to this collection, overwriting those that have the same names.services - the servicespublic void load()
RepositoryServices found in the classpath by a ServiceLoader.public boolean contains(QName name)
true if this collection includes a given RepositoryService.name - the name of the servicetrue if this collection includes the RepositoryService with the given namepublic RepositoryService lookup(QName name)
RepositoryService in this collection.name - the name of the serviceIllegalStateException - if a service with the given name does not existpublic int size()
RepositoryServices in this collection.public Iterator<RepositoryService> iterator()
RepositoryServices in this collection.iterator in interface Iterable<RepositoryService>Copyright © 2018. All rights reserved.