|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IoSessionAttributeMap
Stores the user-defined attributes which is provided per IoSession.
All user-defined attribute accesses in IoSession are forwarded to
the instance of IoSessionAttributeMap.
| Method Summary | |
|---|---|
boolean |
containsAttribute(IoSession session,
Object key)
Returns true if this session contains the attribute with the specified key. |
void |
dispose(IoSession session)
Disposes any releases associated with the specified session. |
Object |
getAttribute(IoSession session,
Object key,
Object defaultValue)
Returns the value of user defined attribute associated with the specified key. |
Set<Object> |
getAttributeKeys(IoSession session)
Returns the set of keys of all user-defined attributes. |
Object |
removeAttribute(IoSession session,
Object key)
Removes a user-defined attribute with the specified key. |
boolean |
removeAttribute(IoSession session,
Object key,
Object value)
Removes a user defined attribute with the specified key if the current attribute value is equal to the specified value. |
boolean |
replaceAttribute(IoSession session,
Object key,
Object oldValue,
Object newValue)
Replaces a user defined attribute with the specified key if the value of the attribute is equals to the specified old value. |
Object |
setAttribute(IoSession session,
Object key,
Object value)
Sets a user-defined attribute. |
Object |
setAttributeIfAbsent(IoSession session,
Object key,
Object value)
Sets a user defined attribute if the attribute with the specified key is not set yet. |
| Method Detail |
|---|
Object getAttribute(IoSession session,
Object key,
Object defaultValue)
if (containsAttribute(key)) {
return getAttribute(key);
} else {
setAttribute(key, defaultValue);
return defaultValue;
}
Object setAttribute(IoSession session,
Object key,
Object value)
key - the key of the attributevalue - the value of the attribute
Object setAttributeIfAbsent(IoSession session,
Object key,
Object value)
if (containsAttribute(key)) {
return getAttribute(key);
} else {
return setAttribute(key, value);
}
Object removeAttribute(IoSession session,
Object key)
boolean removeAttribute(IoSession session,
Object key,
Object value)
if (containsAttribute(key) && getAttribute(key).equals(value)) {
removeAttribute(key);
return true;
} else {
return false;
}
boolean replaceAttribute(IoSession session,
Object key,
Object oldValue,
Object newValue)
if (containsAttribute(key) && getAttribute(key).equals(oldValue)) {
setAttribute(key, newValue);
return true;
} else {
return false;
}
boolean containsAttribute(IoSession session,
Object key)
Set<Object> getAttributeKeys(IoSession session)
void dispose(IoSession session)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||