com.sun.grizzly.attributes
Class DefaultAttributeBuilder

java.lang.Object
  extended by com.sun.grizzly.attributes.DefaultAttributeBuilder
All Implemented Interfaces:
AttributeBuilder

public class DefaultAttributeBuilder
extends Object
implements AttributeBuilder

Default AttributeBuilder implementation.

Author:
Alexey Stashok
See Also:
AttributeBuilder

Field Summary
protected  List<Attribute> attributes
           
protected  Map<String,Attribute> name2Attribute
           
 
Constructor Summary
DefaultAttributeBuilder()
           
 
Method Summary
<T> Attribute<T>
createAttribute(String name)
          Create Attribute with name
<T> Attribute<T>
createAttribute(String name, NullaryFunction<T> initializer)
          Create Attribute with name and initializer, which will be called, if Attribute's value is null on a AttributedObject
<T> Attribute<T>
createAttribute(String name, T defaultValue)
          Create Attribute with name and default value
protected  Attribute getAttributeByIndex(int index)
           
protected  Attribute getAttributeByName(String name)
           
protected static void setAttributeIndex(Attribute attribute, int index)
          Method sets the index to the Attribute Could be used by classes, which extend DefaultAttributeBuilder and don't have access to the protected Attribute.setIndex() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributes

protected List<Attribute> attributes

name2Attribute

protected Map<String,Attribute> name2Attribute
Constructor Detail

DefaultAttributeBuilder

public DefaultAttributeBuilder()
Method Detail

setAttributeIndex

protected static void setAttributeIndex(Attribute attribute,
                                        int index)
Method sets the index to the Attribute Could be used by classes, which extend DefaultAttributeBuilder and don't have access to the protected Attribute.setIndex() method.

Parameters:
attribute -
index -

createAttribute

public <T> Attribute<T> createAttribute(String name)
Create Attribute with name

Specified by:
createAttribute in interface AttributeBuilder
Type Parameters:
T - Type of attribute value
Parameters:
name - attribute name
Returns:
Attribute

createAttribute

public <T> Attribute<T> createAttribute(String name,
                                        T defaultValue)
Create Attribute with name and default value

Specified by:
createAttribute in interface AttributeBuilder
Type Parameters:
T - Type of attribute value
Parameters:
name - attribute name
defaultValue - attribute's default value
Returns:
Attribute

createAttribute

public <T> Attribute<T> createAttribute(String name,
                                        NullaryFunction<T> initializer)
Create Attribute with name and initializer, which will be called, if Attribute's value is null on a AttributedObject

Specified by:
createAttribute in interface AttributeBuilder
Type Parameters:
T - Type of attribute value
Parameters:
name - attribute name
initializer - NullaryFunction, which will be called, if Attribute's value is null on a AttributedObject
Returns:
Attribute

getAttributeByName

protected Attribute getAttributeByName(String name)

getAttributeByIndex

protected Attribute getAttributeByIndex(int index)


Copyright © 2009 SUN Microsystems. All Rights Reserved.