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.ObjectgetAttribute(String name)Return an object based on a name.ObjectgetAttribute(String name, NullaryFunction initializer)Return an object based on a name.AttributeBuildergetAttributeBuilder()Get AttributeBuilder, associated with this holderSet<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 AttributeHolderObjectremoveAttribute(String name)Remove a name/value object.voidsetAttribute(String name, Object value)Set a name/value object.
-
-
-
Method Detail
-
removeAttribute
Object removeAttribute(String name)
Remove a name/value object.- Parameters:
name- - name of an attribute- Returns:
- attribute which has been removed
-
setAttribute
void setAttribute(String name, Object value)
Set a name/value object.- Parameters:
name- - name of an attributevalue- - value of named attribute
-
getAttribute
Object getAttribute(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
Object getAttribute(String name, NullaryFunction 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
Set<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-
-
-