public final class IndexedAttributeHolder extends Object implements AttributeHolder
AttributeHolder
, which supports indexed access to stored
Attribute
s. Access to such indexed Attribute
s could be as
fast as access to array.
This implementation is thread-safe.AttributeHolder
,
NamedAttributeHolder
Modifier and Type | Class and Description |
---|---|
protected class |
IndexedAttributeHolder.IndexedAttributeAccessorImpl
IndexedAttributeAccessor implementation. |
Modifier and Type | Field and Description |
---|---|
protected DefaultAttributeBuilder |
attributeBuilder |
protected IndexedAttributeAccessor |
indexedAttributeAccessor |
Constructor and Description |
---|
IndexedAttributeHolder(AttributeBuilder attributeBuilder)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all the attributes.
|
void |
copyFrom(AttributeHolder srcAttributes)
Copies attributes from the srcAttributes to this AttributeHolder
|
void |
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 holder
|
Set<String> |
getAttributeNames()
Return a
Set of attribute names. |
IndexedAttributeAccessor |
getIndexedAttributeAccessor()
Returns
IndexedAttributeAccessor for accessing Attribute s
by index. |
void |
recycle()
Recycle AttributeHolder
|
Object |
removeAttribute(String name)
Remove a name/value object.
|
void |
setAttribute(String name,
Object value)
Set a name/value object.
|
protected final DefaultAttributeBuilder attributeBuilder
protected final IndexedAttributeAccessor indexedAttributeAccessor
public IndexedAttributeHolder(AttributeBuilder attributeBuilder)
AttributeBuilder.createSafeAttributeHolder()
attributeBuilder
- public Object getAttribute(String name)
getAttribute
in interface AttributeHolder
name
- - name of an attributepublic Object getAttribute(String name, NullaryFunction initializer)
getAttribute
in interface AttributeHolder
name
- - name of an attributeinitializer
- the initializer to be used to assign a default attribute value,
in case it hasn't been assignedpublic void setAttribute(String name, Object value)
setAttribute
in interface AttributeHolder
name
- - name of an attributevalue
- - value of named attributepublic Object removeAttribute(String name)
removeAttribute
in interface AttributeHolder
name
- - name of an attributepublic Set<String> getAttributeNames()
Set
of attribute names.getAttributeNames
in interface AttributeHolder
Set
of attribute namespublic void copyFrom(AttributeHolder srcAttributes)
AttributeHolder
copyFrom
in interface AttributeHolder
public void copyTo(AttributeHolder dstAttributes)
AttributeHolder
copyTo
in interface AttributeHolder
public void recycle()
recycle
in interface AttributeHolder
public void clear()
clear
in interface AttributeHolder
public AttributeBuilder getAttributeBuilder()
getAttributeBuilder
in interface AttributeHolder
public IndexedAttributeAccessor getIndexedAttributeAccessor()
IndexedAttributeAccessor
for accessing Attribute
s
by index.getIndexedAttributeAccessor
in interface AttributeHolder
IndexedAttributeAccessor
for accessing Attribute
s
by index.Copyright © 2015 Oracle Corporation. All rights reserved.