java.lang.Object
org.glassfish.grizzly.attributes.IndexedAttributeHolder
- All Implemented Interfaces:
AttributeHolder
AttributeHolder, which supports indexed access to stored Attributes. Access to such indexed
Attributes could be as fast as access to array.
This implementation is thread-safe.- Author:
- Alexey Stashok
- See Also:
-
AttributeHolderNamedAttributeHolder
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DefaultAttributeBuilderprotected final IndexedAttributeAccessor -
Constructor Summary
Constructors -
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.
-
Field Details
-
attributeBuilder
-
indexedAttributeAccessor
-
-
Constructor Details
-
IndexedAttributeHolder
Deprecated.- Parameters:
attributeBuilder-
-
-
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
Description copied from interface:AttributeHolderCopies attributes from the srcAttributes to this AttributeHolder- Specified by:
copyFromin interfaceAttributeHolder
-
copyTo
Description copied from interface:AttributeHolderCopies attributes from this AttributeHolder to the dstAttributes.- Specified by:
copyToin interfaceAttributeHolder
-
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.
-
AttributeBuilder.createSafeAttributeHolder()