org.opensaml.xml.util
Class ValueTypeIndexedMap<KeyType,ValueType>

java.lang.Object
  extended by org.opensaml.xml.util.ValueTypeIndexedMap<KeyType,ValueType>
Type Parameters:
KeyType - the type of object used as keys
ValueType - the type of object stored as values
All Implemented Interfaces:
java.util.Map<KeyType,ValueType>

public class ValueTypeIndexedMap<KeyType,ValueType>
extends java.lang.Object
implements java.util.Map<KeyType,ValueType>

Map implementation which allows subsets of entries to be retrieved based on the type of the entry value.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
ValueTypeIndexedMap()
          Constructor.
ValueTypeIndexedMap(java.util.Collection<java.lang.Class> newTypes)
          Constructor.
ValueTypeIndexedMap(java.util.Map<KeyType,ValueType> newMap, java.util.Collection<java.lang.Class> newTypes)
          Constructor.
 
Method Summary
 void clear()
          
 boolean containsKey(java.lang.Object key)
          
 boolean containsValue(java.lang.Object value)
          
 java.util.Set<java.util.Map.Entry<KeyType,ValueType>> entrySet()
          
 ValueType get(java.lang.Object key)
          
 java.util.Set<java.lang.Class> getTypes()
          Get the value types that are indexed.
 boolean isEmpty()
          
 java.util.Set<KeyType> keySet()
          
 ValueType put(KeyType key, ValueType value)
          
 void putAll(java.util.Map<? extends KeyType,? extends ValueType> t)
          
 void rebuildIndex()
          Rebuild internal index.
 ValueType remove(java.lang.Object key)
          
 void setTypes(java.util.Collection<java.lang.Class> newTypes)
          Set which value types are indexed.
 int size()
          
<SubType extends ValueType>
java.util.Map<KeyType,SubType>
subMap(java.lang.Class<SubType> type)
          Returns an unmodifiable map of the entries whose value is of the specified type.
 java.lang.String toString()
          
 java.util.Collection<ValueType> values()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ValueTypeIndexedMap

public ValueTypeIndexedMap()
Constructor.


ValueTypeIndexedMap

public ValueTypeIndexedMap(java.util.Map<KeyType,ValueType> newMap,
                           java.util.Collection<java.lang.Class> newTypes)
Constructor.

Parameters:
newMap - existing map to build from.
newTypes - collection of value types to index

ValueTypeIndexedMap

public ValueTypeIndexedMap(java.util.Collection<java.lang.Class> newTypes)
Constructor.

Parameters:
newTypes - collection of value types to index
Method Detail

clear

public void clear()

Specified by:
clear in interface java.util.Map<KeyType,ValueType>

containsKey

public boolean containsKey(java.lang.Object key)

Specified by:
containsKey in interface java.util.Map<KeyType,ValueType>

containsValue

public boolean containsValue(java.lang.Object value)

Specified by:
containsValue in interface java.util.Map<KeyType,ValueType>

entrySet

public java.util.Set<java.util.Map.Entry<KeyType,ValueType>> entrySet()

Specified by:
entrySet in interface java.util.Map<KeyType,ValueType>

get

public ValueType get(java.lang.Object key)

Specified by:
get in interface java.util.Map<KeyType,ValueType>

getTypes

public java.util.Set<java.lang.Class> getTypes()
Get the value types that are indexed.

Returns:
which value types are indexed

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface java.util.Map<KeyType,ValueType>

keySet

public java.util.Set<KeyType> keySet()

Specified by:
keySet in interface java.util.Map<KeyType,ValueType>

put

public ValueType put(KeyType key,
                     ValueType value)

Specified by:
put in interface java.util.Map<KeyType,ValueType>

putAll

public void putAll(java.util.Map<? extends KeyType,? extends ValueType> t)

Specified by:
putAll in interface java.util.Map<KeyType,ValueType>

rebuildIndex

public void rebuildIndex()
Rebuild internal index.


remove

public ValueType remove(java.lang.Object key)

Specified by:
remove in interface java.util.Map<KeyType,ValueType>

setTypes

public void setTypes(java.util.Collection<java.lang.Class> newTypes)
Set which value types are indexed.

Parameters:
newTypes - which value types are indexed

size

public int size()

Specified by:
size in interface java.util.Map<KeyType,ValueType>

subMap

public <SubType extends ValueType> java.util.Map<KeyType,SubType> subMap(java.lang.Class<SubType> type)
Returns an unmodifiable map of the entries whose value is of the specified type.

Type Parameters:
SubType - type of values to include in the returned map
Parameters:
type - type of values to return
Returns:
sub map of entries whose value is of type SubType or null if the specified type is not a valid type for this map.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

values

public java.util.Collection<ValueType> values()

Specified by:
values in interface java.util.Map<KeyType,ValueType>


Copyright © 2006-2012 Internet2. All Rights Reserved.