|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.portal.common.util.TypedMap
public abstract class TypedMap
A decorator that enforce the map content to be checked against a type. Null internal values are not supported.
Nested Class Summary | |
---|---|
class |
TypedMap.KeySet
|
class |
TypedMap.TypedEntrySet
|
class |
TypedMap.ValueCollection
|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
protected MapAccessor |
accessor
The map accessor. |
Constructor Summary | |
---|---|
protected |
TypedMap(java.util.Map delegate)
|
protected |
TypedMap(MapAccessor accessor)
|
Method Summary | |
---|---|
protected void |
assertKeyValidity(java.lang.Object key)
Override to check the validity of the key, the default implementation is an empty method. |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
protected java.util.Map |
convert(java.util.Map t)
Validate the map and unwrap it if necessary. |
java.util.Set |
entrySet()
|
boolean |
equals(java.lang.Object o)
Compare to parameters objects. |
java.lang.Object |
get(java.lang.Object key)
|
protected java.util.Map |
getDelegate(boolean requestWriteable)
Return the map provided by the accessor. |
protected java.lang.Object |
getExternalKey(java.lang.Object key)
Wrap the internal key into its external representation, by default returns the same key. |
protected java.lang.Object |
getExternalValue(java.lang.Object value)
Wrap the internal value into its external representation. |
protected java.lang.Object |
getInternalKey(java.lang.Object key)
Unwraps the key to the the internal key that will be stored in the map. |
protected java.lang.Object |
getInternalValue(java.lang.Object value)
Unwrap the value to the the internal value that will be stored in the map. |
protected boolean |
internalValueEquals(java.lang.Object left,
java.lang.Object right)
Compare internal values, the default implementation delegates the operation to the equals method of the left argument. |
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map t)
|
java.lang.Object |
remove(java.lang.Object key)
|
void |
replace(java.util.Map t)
Replace the content with the new map which is validated before replacement. |
int |
size()
|
java.lang.String |
toString()
|
protected java.lang.Object |
unwrapKey(java.lang.Object externalKey)
|
protected java.lang.Object |
unwrapValue(java.lang.Object externalValue)
Extract the internal value from an external value. |
void |
validate()
Validate the content. |
java.util.Collection |
values()
|
protected java.lang.Object |
wrapKey(java.lang.Object internalKey)
|
protected java.lang.Object |
wrapValue(java.lang.Object internalValue)
Convert an internal value into an external value. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
hashCode |
Field Detail |
---|
protected final MapAccessor accessor
Constructor Detail |
---|
protected TypedMap(MapAccessor accessor)
protected TypedMap(java.util.Map delegate)
Method Detail |
---|
protected final java.util.Map getDelegate(boolean requestWriteable)
requestWriteable
-
protected void assertKeyValidity(java.lang.Object key) throws java.lang.IllegalArgumentException, java.lang.ClassCastException
java.lang.ClassCastException
- if the class of the specified key prevents it from being stored in this map
java.lang.IllegalArgumentException
- if some aspect of this key prevents it from being stored in this mapprotected java.lang.Object getInternalKey(java.lang.Object key) throws java.lang.IllegalArgumentException, java.lang.ClassCastException
assertKeyValidity(Object key)
and returns the same key. It can be overriden to provide a customized
key that will be used instead of the external key.
key
- the key to unwrap
java.lang.ClassCastException
- if the class of the specified key prevents it from being stored in this map
java.lang.IllegalArgumentException
- if some aspect of this key prevents it from being stored in this mapprotected java.lang.Object getExternalKey(java.lang.Object key)
protected final java.lang.Object unwrapKey(java.lang.Object externalKey) throws java.lang.IllegalArgumentException, java.lang.ClassCastException, java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.ClassCastException
java.lang.NullPointerException
protected final java.lang.Object wrapKey(java.lang.Object internalKey) throws java.lang.IllegalStateException
java.lang.IllegalStateException
protected java.lang.Object getInternalValue(java.lang.Object value) throws java.lang.IllegalArgumentException, java.lang.ClassCastException
value
- the value to unwrap
java.lang.ClassCastException
- if the class of the specified value prevents it from being stored in this map
java.lang.IllegalArgumentException
- if some aspect of this value prevents it from being stored in this mapprotected java.lang.Object getExternalValue(java.lang.Object value)
value
- the param value which will not be null
protected final java.lang.Object unwrapValue(java.lang.Object externalValue) throws java.lang.IllegalArgumentException, java.lang.ClassCastException, java.lang.NullPointerException
externalValue
- the external value to unwrap
java.lang.IllegalArgumentException
java.lang.ClassCastException
java.lang.NullPointerException
protected final java.lang.Object wrapValue(java.lang.Object internalValue) throws java.lang.IllegalStateException
internalValue
- the internal value
java.lang.IllegalStateException
- if the internal value was null or some aspect prevented it to be converted to an
external representationprotected boolean internalValueEquals(java.lang.Object left, java.lang.Object right)
left
- right
-
public int size()
size
in interface java.util.Map
public void clear()
clear
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
public java.util.Collection values()
values
in interface java.util.Map
public void putAll(java.util.Map t)
putAll
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void replace(java.util.Map t) throws java.lang.ClassCastException, java.lang.NullPointerException, java.lang.IllegalArgumentException
t
- the replacement map
java.lang.ClassCastException
java.lang.NullPointerException
java.lang.IllegalArgumentException
public void validate() throws java.lang.ClassCastException, java.lang.NullPointerException, java.lang.IllegalArgumentException
java.lang.ClassCastException
java.lang.NullPointerException
java.lang.IllegalArgumentException
protected final java.util.Map convert(java.util.Map t) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.lang.ClassCastException
java.lang.IllegalArgumentException
java.lang.NullPointerException
java.lang.ClassCastException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |