Package org.glassfish.grizzly.attributes
Interface AttributeHolder
-
- All Known Implementing Classes:
IndexedAttributeHolder
public interface AttributeHolderInterface declares common functionality for objects, which have associatedAttributes.- Author:
- Alexey Stashok
- See Also:
IndexedAttributeHolder,NamedAttributeHolder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()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.java.lang.ObjectgetAttribute(java.lang.String name)Return an object based on a name.java.lang.ObjectgetAttribute(java.lang.String name, java.util.function.Supplier initializer)Return an object based on a name.AttributeBuildergetAttributeBuilder()Get AttributeBuilder, associated with this holderjava.util.Set<java.lang.String>getAttributeNames()Return aSetof attribute names.IndexedAttributeAccessorgetIndexedAttributeAccessor()If AttributeHolder supports attribute access by index - it will return anIndexedAttributeAccessor, which will makeAttributeaccess as fast as access to array element.voidrecycle()Recycle AttributeHolderjava.lang.ObjectremoveAttribute(java.lang.String name)Remove a name/value object.voidsetAttribute(java.lang.String name, java.lang.Object value)Set a name/value object.
-
-
-
Method Detail
-
removeAttribute
java.lang.Object removeAttribute(java.lang.String name)
Remove a name/value object.- Parameters:
name- - name of an attribute- Returns:
- attribute which has been removed
-
setAttribute
void setAttribute(java.lang.String name, java.lang.Object value)Set a name/value object.- Parameters:
name- - name of an attributevalue- - value of named attribute
-
getAttribute
java.lang.Object getAttribute(java.lang.String name)
Return an object based on a name.- Parameters:
name- - name of an attribute- Returns:
- - attribute value for the name, null if name does not exist in attributes
-
getAttribute
java.lang.Object getAttribute(java.lang.String name, java.util.function.Supplier initializer)Return an object based on a name.- 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
- Since:
- 2.3.18
-
getAttributeNames
java.util.Set<java.lang.String> getAttributeNames()
Return aSetof attribute names.- Returns:
- -
Setof attribute names
-
clear
void clear()
Clear all the attributes.
-
recycle
void recycle()
Recycle AttributeHolder
-
getAttributeBuilder
AttributeBuilder getAttributeBuilder()
Get AttributeBuilder, associated with this holder- Returns:
- AttributeBuilder
-
getIndexedAttributeAccessor
IndexedAttributeAccessor getIndexedAttributeAccessor()
If AttributeHolder supports attribute access by index - it will return anIndexedAttributeAccessor, which will makeAttributeaccess as fast as access to array element.- Returns:
IndexedAttributeAccessor.
-
copyTo
void copyTo(AttributeHolder dstAttributes)
Copies attributes from this AttributeHolder to the dstAttributes.- Parameters:
dstAttributes-
-
copyFrom
void copyFrom(AttributeHolder srcAttributes)
Copies attributes from the srcAttributes to this AttributeHolder- Parameters:
srcAttributes-
-
-