org.glassfish.grizzly.attributes
Class DefaultAttributeBuilder

java.lang.Object
  extended by org.glassfish.grizzly.attributes.DefaultAttributeBuilder
All Implemented Interfaces:
AttributeBuilder

public class DefaultAttributeBuilder
extends java.lang.Object
implements AttributeBuilder

Default AttributeBuilder implementation.

Author:
Alexey Stashok
See Also:
AttributeBuilder

Field Summary
protected  java.util.List<Attribute> attributes
           
protected  java.util.Map<java.lang.String,Attribute> name2Attribute
           
 
Fields inherited from interface org.glassfish.grizzly.attributes.AttributeBuilder
DEFAULT_ATTRIBUTE_BUILDER
 
Constructor Summary
DefaultAttributeBuilder()
           
 
Method Summary
<T> Attribute<T>
createAttribute(java.lang.String name)
          Create Attribute with name
<T> Attribute<T>
createAttribute(java.lang.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(java.lang.String name, T defaultValue)
          Create Attribute with name and default value
protected  Attribute getAttributeByIndex(int index)
           
protected  Attribute getAttributeByName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributes

protected final java.util.List<Attribute> attributes

name2Attribute

protected final java.util.Map<java.lang.String,Attribute> name2Attribute
Constructor Detail

DefaultAttributeBuilder

public DefaultAttributeBuilder()
Method Detail

createAttribute

public <T> Attribute<T> createAttribute(java.lang.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(java.lang.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(java.lang.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(java.lang.String name)

getAttributeByIndex

protected Attribute getAttributeByIndex(int index)


Copyright © 2011 Oracle Corpration. All Rights Reserved.