Package org.restlet.util
Class ServiceList
- java.lang.Object
 - 
- org.restlet.util.WrapperList<Service>
 - 
- org.restlet.util.ServiceList
 
 
 
- 
- All Implemented Interfaces:
 java.lang.Iterable<Service>,java.util.Collection<Service>,java.util.List<Service>
public final class ServiceList extends WrapperList<Service>
Modifiable list of services.- Author:
 - Jerome Louvel
 
 
- 
- 
Constructor Summary
Constructors Constructor Description ServiceList(Context context)Constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Service service)Inserts the specified element at the specified position in this list.booleanadd(Service service)Adds a element at the end of the list.booleanaddAll(int index, java.util.Collection<? extends Service> services)Inserts all of the elements in the specified collection into this list at the specified position.booleanaddAll(java.util.Collection<? extends Service> services)Appends all of the elements in the specified collection to the end of this list.<T extends Service>
Tget(java.lang.Class<T> clazz)Returns a service matching a given service class.ContextgetContext()Returns the context.voidset(java.util.List<Service> services)Sets the list of services.voidset(Service newService)Replaces or adds a service.voidsetContext(Context context)Sets the context.voidstart()Starts each service.voidstop()Stops each service.- 
Methods inherited from class org.restlet.util.WrapperList
clear, contains, containsAll, equals, get, getDelegate, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray, toString 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
ServiceList
public ServiceList(Context context)
Constructor.- Parameters:
 context- The context.
 
 - 
 
- 
Method Detail
- 
add
public void add(int index, Service service)Description copied from class:WrapperListInserts the specified element at the specified position in this list.- Specified by:
 addin interfacejava.util.List<Service>- Overrides:
 addin classWrapperList<Service>- Parameters:
 index- The insertion position.service- The element to insert.
 
- 
add
public boolean add(Service service)
Description copied from class:WrapperListAdds a element at the end of the list.- Specified by:
 addin interfacejava.util.Collection<Service>- Specified by:
 addin interfacejava.util.List<Service>- Overrides:
 addin classWrapperList<Service>- Returns:
 - True (as per the general contract of the Collection.add method).
 
 
- 
addAll
public boolean addAll(java.util.Collection<? extends Service> services)
Description copied from class:WrapperListAppends all of the elements in the specified collection to the end of this list.- Specified by:
 addAllin interfacejava.util.Collection<Service>- Specified by:
 addAllin interfacejava.util.List<Service>- Overrides:
 addAllin classWrapperList<Service>- Parameters:
 services- The collection of elements to append.
 
- 
addAll
public boolean addAll(int index, java.util.Collection<? extends Service> services)Description copied from class:WrapperListInserts all of the elements in the specified collection into this list at the specified position.- Specified by:
 addAllin interfacejava.util.List<Service>- Overrides:
 addAllin classWrapperList<Service>- Parameters:
 index- The insertion position.services- The collection of elements to insert.
 
- 
get
public <T extends Service> T get(java.lang.Class<T> clazz)
Returns a service matching a given service class.- Type Parameters:
 T- The service type.- Parameters:
 clazz- The service class to match.- Returns:
 - The matched service instance.
 
 
- 
getContext
public Context getContext()
Returns the context.- Returns:
 - The context.
 
 
- 
set
public void set(java.util.List<Service> services)
Sets the list of services.- Parameters:
 services- The list of services.
 
- 
set
public void set(Service newService)
Replaces or adds a service. The replacement is based on the service class.- Parameters:
 newService- The new service to set.
 
- 
setContext
public void setContext(Context context)
Sets the context. By default, it also updates the context of already registered services.- Parameters:
 context- The context.
 
- 
start
public void start() throws java.lang.ExceptionStarts each service.- Throws:
 java.lang.Exception
 
- 
stop
public void stop() throws java.lang.ExceptionStops each service.- Throws:
 java.lang.Exception
 
 - 
 
 -