public class ServiceList
extends java.lang.Object
implements java.util.List
Collection
or a List
, that can be passed to helper objects (Collaborators).
The Collection.iterator()
method returns an Iterator
iterating
on a cached copy of available service objects. In the case that there are no
available services, the policies act as follows:
Constructor and Description |
---|
ServiceList(Dependency dep)
Creates a Service Collection.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
java.lang.Object obj)
Unsupported method.
|
boolean |
add(java.lang.Object o)
Unsupported method.
|
boolean |
addAll(java.util.Collection c)
Unsupported method.
|
boolean |
addAll(int index,
java.util.Collection c)
Unsupported method.
|
void |
clear()
Unsupported method.
|
boolean |
contains(java.lang.Object o)
Checks if the wrapped dependency has always access to the
given service object.The method allows knowing if the provider returning the
service object has left.
|
boolean |
containsAll(java.util.Collection c)
Checks if the wrapped dependencies has always access to the
given service objects.The method allows knowing if providers returning the
service objects have left.
|
java.lang.Object |
get(int index)
Gets the object stored at the given index.
|
int |
indexOf(java.lang.Object o)
Gets the index of the given object in the current
collection.
|
boolean |
isEmpty()
Checks if at least one provider matching with the dependency
is available.
|
java.util.Iterator |
iterator()
Gets an iterator on the current list of available service objects.
|
int |
lastIndexOf(java.lang.Object o)
Gets the last index of the given object in the current
collection.
|
java.util.ListIterator |
listIterator()
Gets a list iterator on the current list of available service objects.
|
java.util.ListIterator |
listIterator(int index)
Unsupported Method.
|
java.lang.Object |
remove(int index)
Unsupported method.
|
boolean |
remove(java.lang.Object o)
Unsupported method.
|
boolean |
removeAll(java.util.Collection c)
Unsupported method.
|
boolean |
retainAll(java.util.Collection c)
Unsupported method.
|
java.lang.Object |
set(int arg0,
java.lang.Object arg1)
Unsupported Method.
|
int |
size()
Gets the number of available providers.
|
java.util.List |
subList(int fromIndex,
int toIndex)
Returns a sublist from the current list.
|
java.lang.Object[] |
toArray()
Returns an array containing available service objects.
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
Returns an array containing available service objects.
|
public ServiceList(Dependency dep)
dep
- the wrapped dependencypublic boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.List
o
- an objectCollection.add(java.lang.Object)
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
c
- an objectCollection.addAll(java.util.Collection)
public void add(int index, java.lang.Object obj)
add
in interface java.util.List
index
- an indexobj
- an objectList.add(int, java.lang.Object)
public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
index
- an indexc
- an objectList.addAll(int, java.util.Collection)
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
Collection.clear()
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
contains
in interface java.util.List
o
- the service objecttrue
if the object is still available,
false
otherwise.Collection.contains(java.lang.Object)
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.List
c
- the set of service objecttrue
if the objects are still available,
false
otherwise.Collection.contains(java.lang.Object)
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.List
true
if one provider or more satisfying the
dependency are available. Otherwise, returns false
Collection.isEmpty()
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.List
Collection.iterator()
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.List
o
- a objectCollection.remove(java.lang.Object)
public java.lang.Object remove(int index)
remove
in interface java.util.List
index
- the indexCollection.remove(java.lang.Object)
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
c
- a set of objectsCollection.removeAll(java.util.Collection)
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.List
c
- a set of objectsCollection.retainAll(java.util.Collection)
public int size()
size
in interface java.util.Collection
size
in interface java.util.List
Collection.size()
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.List
Collection.toArray()
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Collection
toArray
in interface java.util.List
a
- the array into which the elements of this collection
are to be stored, if it is big enough; otherwise, a new array
of the same runtime type is allocated for this purpose.Collection.toArray(java.lang.Object[])
public java.lang.Object get(int index)
get
in interface java.util.List
index
- the indexList.get(int)
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List
o
- the object-1
if not found.List.indexOf(java.lang.Object)
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List
o
- the object-1
if not found.List.lastIndexOf(java.lang.Object)
public java.util.ListIterator listIterator()
listIterator
in interface java.util.List
List.listIterator()
public java.util.ListIterator listIterator(int index)
listIterator
in interface java.util.List
index
- an indexList.listIterator(int)
public java.lang.Object set(int arg0, java.lang.Object arg1)
set
in interface java.util.List
arg0
- an indexarg1
- an objectList.set(int, Object)
public java.util.List subList(int fromIndex, int toIndex)
subList
in interface java.util.List
fromIndex
- the index of the list beginningtoIndex
- the index of the list endList.subList(int, int)
Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.