org.glassfish.grizzly.attributes
Class IndexedAttributeHolder

java.lang.Object
  extended by org.glassfish.grizzly.attributes.IndexedAttributeHolder
All Implemented Interfaces:
AttributeHolder

public final class IndexedAttributeHolder
extends java.lang.Object
implements AttributeHolder

AttributeHolder, which supports indexed access to stored Attributes. Access to such indexed Attributes could be as fast as access to array.

Author:
Alexey Stashok
See Also:
AttributeHolder, NamedAttributeHolder

Nested Class Summary
protected  class IndexedAttributeHolder.IndexedAttributeAccessorImpl
          IndexedAttributeAccessor implementation.
 
Field Summary
protected  DefaultAttributeBuilder attributeBuilder
           
protected  IndexedAttributeAccessor indexedAttributeAccessor
           
 
Constructor Summary
IndexedAttributeHolder(AttributeBuilder attributeBuilder)
           
 
Method Summary
 void clear()
          Clear all the attributes.
 java.lang.Object getAttribute(java.lang.String name)
          Return an object based on a name.
 AttributeBuilder getAttributeBuilder()
          Get AttributeBuilder, associated with this holder
 java.util.Set<java.lang.String> getAttributeNames()
          Return a Set of attribute names.
 IndexedAttributeAccessor getIndexedAttributeAccessor()
          Returns IndexedAttributeAccessor for accessing Attributes by index.
 void recycle()
          Recycle AttributeHolder
 java.lang.Object removeAttribute(java.lang.String name)
          Remove a name/value object.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set a name/value object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributeBuilder

protected final DefaultAttributeBuilder attributeBuilder

indexedAttributeAccessor

protected final IndexedAttributeAccessor indexedAttributeAccessor
Constructor Detail

IndexedAttributeHolder

public IndexedAttributeHolder(AttributeBuilder attributeBuilder)
Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Return an object based on a name.

Specified by:
getAttribute in interface AttributeHolder
Parameters:
name - - name of an attribute
Returns:
- attribute value for the name, null if name does not exist in attributes

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set a name/value object.

Specified by:
setAttribute in interface AttributeHolder
Parameters:
name - - name of an attribute
value - - value of named attribute

removeAttribute

public java.lang.Object removeAttribute(java.lang.String name)
Remove a name/value object.

Specified by:
removeAttribute in interface AttributeHolder
Parameters:
name - - name of an attribute
Returns:
attribute which has been removed

getAttributeNames

public java.util.Set<java.lang.String> getAttributeNames()
Return a Set of attribute names.

Specified by:
getAttributeNames in interface AttributeHolder
Returns:
- Set of attribute names

recycle

public void recycle()
Recycle AttributeHolder

Specified by:
recycle in interface AttributeHolder

clear

public void clear()
Clear all the attributes.

Specified by:
clear in interface AttributeHolder

getAttributeBuilder

public AttributeBuilder getAttributeBuilder()
Get AttributeBuilder, associated with this holder

Specified by:
getAttributeBuilder in interface AttributeHolder
Returns:
AttributeBuilder

getIndexedAttributeAccessor

public IndexedAttributeAccessor getIndexedAttributeAccessor()
Returns IndexedAttributeAccessor for accessing Attributes by index.

Specified by:
getIndexedAttributeAccessor in interface AttributeHolder
Returns:
IndexedAttributeAccessor for accessing Attributes by index.


Copyright © 2012 Oracle Corporation. All Rights Reserved.