Module org.glassfish.grizzly
Package org.glassfish.grizzly.attributes
Class IndexedMapAttributeHolder
java.lang.Object
org.glassfish.grizzly.attributes.IndexedMapAttributeHolder
- All Implemented Interfaces:
AttributeHolder
An
AttributeHolder implementation, which stores Attribute values in a ConcurrentMap,
accessing them by Attribute.index().
This implementation is thread-safe.
- Author:
- Bongjae Chang
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all the attributes.voidcopyFrom(AttributeHolder srcAttributes) Copies attributes from the srcAttributes to this AttributeHoldervoidcopyTo(AttributeHolder dstAttributes) Copies attributes from this AttributeHolder to the dstAttributes.getAttribute(String name) Return an object based on a name.getAttribute(String name, Supplier initializer) Return an object based on a name.Get AttributeBuilder, associated with this holderReturn aSetof attribute names.ReturnsIndexedAttributeAccessorfor accessingAttributes by index.voidrecycle()Recycle AttributeHolderremoveAttribute(String name) Remove a name/value object.voidsetAttribute(String name, Object value) Set a name/value object.
-
Method Details
-
getAttribute
Return an object based on a name.- Specified by:
getAttributein interfaceAttributeHolder- Parameters:
name- - name of an attribute- Returns:
- - attribute value for the name, null if name does not exist in attributes
-
getAttribute
Return an object based on a name.- Specified by:
getAttributein interfaceAttributeHolder- Parameters:
name- - name of an attributeinitializer- the initializer to be used to assign a default attribute value, in case it hasn't been assigned- Returns:
- - attribute value for the name, null if name does not exist in attributes
-
setAttribute
Set a name/value object.- Specified by:
setAttributein interfaceAttributeHolder- Parameters:
name- - name of an attributevalue- - value of named attribute
-
removeAttribute
Remove a name/value object.- Specified by:
removeAttributein interfaceAttributeHolder- Parameters:
name- - name of an attribute- Returns:
- attribute which has been removed
-
getAttributeNames
Return aSetof attribute names.- Specified by:
getAttributeNamesin interfaceAttributeHolder- Returns:
- -
Setof attribute names
-
copyFrom
Copies attributes from the srcAttributes to this AttributeHolder- Specified by:
copyFromin interfaceAttributeHolder- Parameters:
srcAttributes-
-
copyTo
Copies attributes from this AttributeHolder to the dstAttributes.- Specified by:
copyToin interfaceAttributeHolder- Parameters:
dstAttributes-
-
recycle
public void recycle()Recycle AttributeHolder- Specified by:
recyclein interfaceAttributeHolder
-
clear
public void clear()Clear all the attributes.- Specified by:
clearin interfaceAttributeHolder
-
getAttributeBuilder
Get AttributeBuilder, associated with this holder- Specified by:
getAttributeBuilderin interfaceAttributeHolder- Returns:
- AttributeBuilder
-
getIndexedAttributeAccessor
ReturnsIndexedAttributeAccessorfor accessingAttributes by index.- Specified by:
getIndexedAttributeAccessorin interfaceAttributeHolder- Returns:
IndexedAttributeAccessorfor accessingAttributes by index.
-