public class MapContext extends Object implements Map<String,Object>, Serializable
MapContext
provides a common base for context-based data storage in a Map
. Type-safe attribute
retrieval is provided for subclasses with the getTypedValue(String, Class)
method.SubjectContext
,
SessionContext
,
Serialized FormConstructor and Description |
---|
MapContext() |
MapContext(Map<String,Object> map) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object o) |
boolean |
containsValue(Object o) |
Set<Map.Entry<String,Object>> |
entrySet() |
Object |
get(Object o) |
protected <E> E |
getTypedValue(String key,
Class<E> type)
Performs a
get operation but additionally ensures that the value returned is of the specified
type . |
boolean |
isEmpty() |
Set<String> |
keySet() |
protected void |
nullSafePut(String key,
Object value)
Places a value in this context map under the given key only if the given
value argument is not null. |
Object |
put(String s,
Object o) |
void |
putAll(Map<? extends String,?> map) |
Object |
remove(Object o) |
int |
size() |
Collection<Object> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public MapContext()
public MapContext(Map<String,Object> map)
protected <E> E getTypedValue(String key, Class<E> type)
get
operation but additionally ensures that the value returned is of the specified
type
. If there is no value, null
is returned.E
- the expected type of the valuekey
- the attribute key to look up a valuetype
- the expected type of the valuenull
if the attribute does not exist.protected void nullSafePut(String key, Object value)
value
argument is not null.key
- the attribute key under which the non-null value will be storedvalue
- the non-null value to store. If null
, this method does nothing and returns immediately.public boolean containsKey(Object o)
containsKey
in interface Map<String,Object>
public boolean containsValue(Object o)
containsValue
in interface Map<String,Object>
Copyright © 2004-2016 The Apache Software Foundation. All Rights Reserved.