public interface IoSessionAttributeMap
IoSession
.
All user-defined attribute accesses in IoSession
are forwarded to
the instance of IoSessionAttributeMap
.Modifier and Type | Method and Description |
---|---|
boolean |
containsAttribute(IoSession session,
java.lang.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.
|
java.lang.Object |
getAttribute(IoSession session,
java.lang.Object key,
java.lang.Object defaultValue)
Returns the value of user defined attribute associated with the
specified key.
|
java.util.Set<java.lang.Object> |
getAttributeKeys(IoSession session)
Returns the set of keys of all user-defined attributes.
|
java.lang.Object |
removeAttribute(IoSession session,
java.lang.Object key)
Removes a user-defined attribute with the specified key.
|
boolean |
removeAttribute(IoSession session,
java.lang.Object key,
java.lang.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,
java.lang.Object key,
java.lang.Object oldValue,
java.lang.Object newValue)
Replaces a user defined attribute with the specified key if the
value of the attribute is equals to the specified old value.
|
java.lang.Object |
setAttribute(IoSession session,
java.lang.Object key,
java.lang.Object value)
Sets a user-defined attribute.
|
java.lang.Object |
setAttributeIfAbsent(IoSession session,
java.lang.Object key,
java.lang.Object value)
Sets a user defined attribute if the attribute with the specified key
is not set yet.
|
java.lang.Object getAttribute(IoSession session, java.lang.Object key, java.lang.Object defaultValue)
if (containsAttribute(key)) { return getAttribute(key); } else { setAttribute(key, defaultValue); return defaultValue; }
java.lang.Object setAttribute(IoSession session, java.lang.Object key, java.lang.Object value)
key
- the key of the attributevalue
- the value of the attributejava.lang.Object setAttributeIfAbsent(IoSession session, java.lang.Object key, java.lang.Object value)
if (containsAttribute(key)) { return getAttribute(key); } else { return setAttribute(key, value); }
java.lang.Object removeAttribute(IoSession session, java.lang.Object key)
boolean removeAttribute(IoSession session, java.lang.Object key, java.lang.Object value)
if (containsAttribute(key) && getAttribute(key).equals(value)) { removeAttribute(key); return true; } else { return false; }
boolean replaceAttribute(IoSession session, java.lang.Object key, java.lang.Object oldValue, java.lang.Object newValue)
if (containsAttribute(key) && getAttribute(key).equals(oldValue)) { setAttribute(key, newValue); return true; } else { return false; }
boolean containsAttribute(IoSession session, java.lang.Object key)
java.util.Set<java.lang.Object> getAttributeKeys(IoSession session)
void dispose(IoSession session) throws java.lang.Exception
java.lang.Exception
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.