org.restlet.util
Class ServiceList

java.lang.Object
  extended by org.restlet.util.WrapperList<Service>
      extended by org.restlet.util.ServiceList
All Implemented Interfaces:
Iterable<Service>, Collection<Service>, List<Service>

public final class ServiceList
extends WrapperList<Service>

Modifiable list of services.

Author:
Jerome Louvel

Constructor Summary
ServiceList(Context context)
          Constructor.
 
Method Summary
 void add(int index, Service service)
          Inserts the specified element at the specified position in this list.
 boolean add(Service service)
          Adds a element at the end of the list.
 boolean addAll(Collection<? extends Service> services)
          Appends all of the elements in the specified collection to the end of this list.
 boolean addAll(int index, Collection<? extends Service> services)
          Inserts all of the elements in the specified collection into this list at the specified position.
<T extends Service>
T
get(Class<T> clazz)
          Returns a service matching a given service class.
 Context getContext()
          Returns the context.
 void set(List<Service> services)
          Sets the list of services.
 void set(Service newService)
          Replaces or adds a service.
 void setContext(Context context)
          Sets the context.
 void start()
          Starts each service.
 void stop()
          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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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: WrapperList
Inserts the specified element at the specified position in this list.

Specified by:
add in interface List<Service>
Overrides:
add in class WrapperList<Service>
Parameters:
index - The insertion position.
service - The element to insert.

add

public boolean add(Service service)
Description copied from class: WrapperList
Adds a element at the end of the list.

Specified by:
add in interface Collection<Service>
Specified by:
add in interface List<Service>
Overrides:
add in class WrapperList<Service>
Returns:
True (as per the general contract of the Collection.add method).

addAll

public boolean addAll(Collection<? extends Service> services)
Description copied from class: WrapperList
Appends all of the elements in the specified collection to the end of this list.

Specified by:
addAll in interface Collection<Service>
Specified by:
addAll in interface List<Service>
Overrides:
addAll in class WrapperList<Service>
Parameters:
services - The collection of elements to append.

addAll

public boolean addAll(int index,
                      Collection<? extends Service> services)
Description copied from class: WrapperList
Inserts all of the elements in the specified collection into this list at the specified position.

Specified by:
addAll in interface List<Service>
Overrides:
addAll in class WrapperList<Service>
Parameters:
index - The insertion position.
services - The collection of elements to insert.

get

public <T extends Service> T get(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(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 Exception
Starts each service.

Throws:
Exception

stop

public void stop()
          throws Exception
Stops each service.

Throws:
Exception


Copyright © 2005-2013 Restlet.