Package org.glassfish.grizzly.attributes
Class DefaultAttributeBuilder
- java.lang.Object
-
- org.glassfish.grizzly.attributes.DefaultAttributeBuilder
-
- All Implemented Interfaces:
AttributeBuilder
public class DefaultAttributeBuilder extends Object implements AttributeBuilder
DefaultAttributeBuilderimplementation.- Author:
- Alexey Stashok
- See Also:
AttributeBuilder
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Attribute>attributesprotected Map<String,Attribute>name2Attribute-
Fields inherited from interface org.glassfish.grizzly.attributes.AttributeBuilder
DEFAULT_ATTRIBUTE_BUILDER
-
-
Constructor Summary
Constructors Constructor Description DefaultAttributeBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <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, 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 valueAttributeHoldercreateSafeAttributeHolder()Creates and returns new thread-safeAttributeHolderAttributeHoldercreateUnsafeAttributeHolder()Creates and returns new non thread-safeAttributeHolderprotected AttributegetAttributeByIndex(int index)protected AttributegetAttributeByName(String name)
-
-
-
Method Detail
-
createAttribute
public <T> Attribute<T> createAttribute(String name)
Create Attribute with name- Specified by:
createAttributein interfaceAttributeBuilder- 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:
createAttributein interfaceAttributeBuilder- Type Parameters:
T- Type of attribute value- Parameters:
name- attribute namedefaultValue- 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:
createAttributein interfaceAttributeBuilder- Type Parameters:
T- Type of attribute value- Parameters:
name- attribute nameinitializer- NullaryFunction, which will be called, if Attribute's value is null on a AttributedObject- Returns:
- Attribute
-
createAttribute
public <T> Attribute<T> createAttribute(String name, NullaryFunction<T> initializer)
Description copied from interface:AttributeBuilderCreate Attribute with name and initializer, which will be called, if Attribute's value is null on a AttributedObject- Specified by:
createAttributein interfaceAttributeBuilder- Type Parameters:
T- Type of attribute value- Parameters:
name- attribute nameinitializer- NullaryFunction, which will be called, if Attribute's value is null on a AttributedObject- Returns:
- Attribute
-
createSafeAttributeHolder
public AttributeHolder createSafeAttributeHolder()
Description copied from interface:AttributeBuilderCreates and returns new thread-safeAttributeHolder- Specified by:
createSafeAttributeHolderin interfaceAttributeBuilder- Returns:
- thread-safe
AttributeHolder
-
createUnsafeAttributeHolder
public AttributeHolder createUnsafeAttributeHolder()
Description copied from interface:AttributeBuilderCreates and returns new non thread-safeAttributeHolder- Specified by:
createUnsafeAttributeHolderin interfaceAttributeBuilder- Returns:
- non thread-safe
AttributeHolder
-
getAttributeByIndex
protected Attribute getAttributeByIndex(int index)
-
-