|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--viceroy.misc.typeSafeCollections.TypeSafeMap
|
+--viceroy.misc.typeSafeCollections.TypeSafeSortedMap
Implementation of the java.util.SortedMap class which accepts only key and value objects of a given type for put operations. Is backed by another implementation of SortedMap.
| Nested Class Summary |
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Field Summary | |
private java.util.SortedMap |
_map
|
| Constructor Summary | |
TypeSafeSortedMap(java.util.SortedMap map,
java.lang.Class keyType,
java.lang.Class valueType)
Constructs a new TypeSafeSortedMap object. |
|
| Method Summary | |
protected void |
checkKeyType(java.lang.Object o)
Tests whether a key object is an instance of the allowed type. |
protected void |
checkType(java.lang.Object o,
java.lang.Class type)
Tests whether an object is an instance of the allowed type. |
protected void |
checkValueType(java.lang.Object o)
Tests whether a value object is an instance of the allowed type. |
void |
clear()
see java.util.Map |
java.util.Comparator |
comparator()
see java.util.SortedMap |
boolean |
containsKey(java.lang.Object key)
see java.util.Map |
boolean |
containsValue(java.lang.Object value)
see java.util.Map |
java.util.Set |
entrySet()
see java.util.Map Returns a type safe java.util.Set which prevents values of the wrong type to be set via the stored java.util.Map.Entry object. |
boolean |
equals(java.lang.Object o)
see java.util.Map |
java.lang.Object |
firstKey()
see java.util.SortedMap |
java.lang.Object |
get(java.lang.Object key)
see java.util.Map |
protected java.lang.Class |
getKeyType()
Returns the type of the keys. |
protected java.lang.Class |
getValueType()
Returns the type of the values. |
java.util.SortedMap |
headMap(java.lang.Object toKey)
See java.util.SortedMap Returns a type safe java.util.SortedMap |
boolean |
isEmpty()
see java.util.Map |
java.util.Set |
keySet()
see java.util.Map |
java.lang.Object |
lastKey()
see java.util.SortedMap |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
see java.util.Map Checks the types of the key and value objects |
void |
putAll(java.util.Map t)
see java.util.Map Checks the types of the key and value objects in the Map |
java.lang.Object |
remove(java.lang.Object key)
see java.util.Map |
int |
size()
see java.util.Map |
java.util.SortedMap |
subMap(java.lang.Object fromKey,
java.lang.Object toKey)
See java.util.SortedMap Returns a type safe java.util.SortedMap |
java.util.SortedMap |
tailMap(java.lang.Object fromKey)
See java.util.SortedMap Returns a type safe java.util.SortedMap |
java.util.Collection |
values()
see java.util.Map |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
| Field Detail |
private java.util.SortedMap _map
| Constructor Detail |
public TypeSafeSortedMap(java.util.SortedMap map,
java.lang.Class keyType,
java.lang.Class valueType)
map - the map to be wrappedkeyType - the type of the objects which can be used as keysvalueType - the type of the objects which can be added as values| Method Detail |
public java.util.Comparator comparator()
comparator in interface java.util.SortedMappublic java.lang.Object firstKey()
firstKey in interface java.util.SortedMappublic java.lang.Object lastKey()
lastKey in interface java.util.SortedMappublic java.util.SortedMap headMap(java.lang.Object toKey)
headMap in interface java.util.SortedMap
public java.util.SortedMap subMap(java.lang.Object fromKey,
java.lang.Object toKey)
subMap in interface java.util.SortedMappublic java.util.SortedMap tailMap(java.lang.Object fromKey)
tailMap in interface java.util.SortedMap
protected void checkType(java.lang.Object o,
java.lang.Class type)
o - The object to be checked
java.lang.ClassCastException - if the object is not of the right typeprotected void checkKeyType(java.lang.Object o)
o - The key object to be checked
java.lang.ClassCastException - if the object is not of the right typeprotected void checkValueType(java.lang.Object o)
o - The value object to be checked
java.lang.ClassCastException - if the object is not of the right typeprotected java.lang.Class getKeyType()
protected java.lang.Class getValueType()
public int size()
size in interface java.util.Mappublic boolean isEmpty()
isEmpty in interface java.util.Mappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Mappublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Mappublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Map
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mappublic void putAll(java.util.Map t)
putAll in interface java.util.Mappublic void clear()
clear in interface java.util.Mappublic java.util.Set keySet()
keySet in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic boolean equals(java.lang.Object o)
equals in interface java.util.Mapequals in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||