Package org.glassfish.grizzly.attributes
Interface AttributeHolder
-
- All Known Implementing Classes:
IndexedAttributeHolder
public interface AttributeHolder
Interface declares common functionality for objects, which have associatedAttribute
s.- Author:
- Alexey Stashok
- See Also:
IndexedAttributeHolder
,NamedAttributeHolder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Clear all the attributes.void
copyFrom(AttributeHolder srcAttributes)
Copies attributes from the srcAttributes to this AttributeHoldervoid
copyTo(AttributeHolder dstAttributes)
Copies attributes from this AttributeHolder to the dstAttributes.Object
getAttribute(String name)
Return an object based on a name.Object
getAttribute(String name, NullaryFunction initializer)
Return an object based on a name.AttributeBuilder
getAttributeBuilder()
Get AttributeBuilder, associated with this holderSet<String>
getAttributeNames()
Return aSet
of attribute names.IndexedAttributeAccessor
getIndexedAttributeAccessor()
If AttributeHolder supports attribute access by index - it will return anIndexedAttributeAccessor
, which will makeAttribute
access as fast as access to array element.void
recycle()
Recycle AttributeHolderObject
removeAttribute(String name)
Remove a name/value object.void
setAttribute(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 aSet
of attribute names.- Returns:
- -
Set
of 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 makeAttribute
access 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
-
-
-