net.shibboleth.metadata.util
Class ItemCollectionWithMetadata<ItemType extends Item>

java.lang.Object
  extended by net.shibboleth.metadata.util.ItemCollectionWithMetadata<ItemType>
Type Parameters:
ItemType - type of items stored in this collection
All Implemented Interfaces:
Iterable<ItemType>, Collection<ItemType>

public class ItemCollectionWithMetadata<ItemType extends Item>
extends Object
implements Collection<ItemType>

A wrapper around a delegate collection that allows the collection to carry item metadata.


Field Summary
private  Collection<ItemType> delegate
          The delegate collection.
private  ClassToInstanceMultiMap<ItemMetadata> metadata
          Additional processing information associated with this collection of Items.
 
Constructor Summary
ItemCollectionWithMetadata()
          Constructor.
ItemCollectionWithMetadata(Collection<ItemType> wrappedCollection)
          Constructor.
 
Method Summary
 boolean add(ItemType e)
          
 boolean addAll(Collection<? extends ItemType> c)
          
 void clear()
          
 boolean contains(Object o)
          
 boolean containsAll(Collection<?> c)
          
 ClassToInstanceMultiMap<ItemMetadata> getCollectionMetadata()
          Gets the ItemMetadata for this collection.
 boolean isEmpty()
          
 Iterator<ItemType> iterator()
          
 boolean remove(Object o)
          
 boolean removeAll(Collection<?> c)
          
 boolean retainAll(Collection<?> c)
          
 int size()
          
 Object[] toArray()
          
<T> T[]
toArray(T[] a)
          
<T extends Collection<ItemType>>
T
unwrap()
          Gets the underlying collection used to store Items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

delegate

private final Collection<ItemType extends Item> delegate
The delegate collection.


metadata

private final ClassToInstanceMultiMap<ItemMetadata> metadata
Additional processing information associated with this collection of Items.

Constructor Detail

ItemCollectionWithMetadata

public ItemCollectionWithMetadata()
Constructor.


ItemCollectionWithMetadata

public ItemCollectionWithMetadata(Collection<ItemType> wrappedCollection)
Constructor.

Parameters:
wrappedCollection - the underlying collection that holds the items
Method Detail

unwrap

public <T extends Collection<ItemType>> T unwrap()
Gets the underlying collection used to store Items.

Type Parameters:
T - type of the underlying collection
Returns:
the underlying collection, never null

getCollectionMetadata

public ClassToInstanceMultiMap<ItemMetadata> getCollectionMetadata()
Gets the ItemMetadata for this collection.

Returns:
the ItemMetadata for this collection, never null

size

public int size()

Specified by:
size in interface Collection<ItemType extends Item>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Collection<ItemType extends Item>

contains

public boolean contains(Object o)

Specified by:
contains in interface Collection<ItemType extends Item>

iterator

public Iterator<ItemType> iterator()

Specified by:
iterator in interface Iterable<ItemType extends Item>
Specified by:
iterator in interface Collection<ItemType extends Item>

toArray

public Object[] toArray()

Specified by:
toArray in interface Collection<ItemType extends Item>

toArray

public <T> T[] toArray(T[] a)

Specified by:
toArray in interface Collection<ItemType extends Item>

add

public boolean add(ItemType e)

Specified by:
add in interface Collection<ItemType extends Item>

remove

public boolean remove(Object o)

Specified by:
remove in interface Collection<ItemType extends Item>

containsAll

public boolean containsAll(Collection<?> c)

Specified by:
containsAll in interface Collection<ItemType extends Item>

addAll

public boolean addAll(Collection<? extends ItemType> c)

Specified by:
addAll in interface Collection<ItemType extends Item>

removeAll

public boolean removeAll(Collection<?> c)

Specified by:
removeAll in interface Collection<ItemType extends Item>

retainAll

public boolean retainAll(Collection<?> c)

Specified by:
retainAll in interface Collection<ItemType extends Item>

clear

public void clear()

Specified by:
clear in interface Collection<ItemType extends Item>


Copyright © 2009-2011. All Rights Reserved.