T - public final class Attribute<T> extends Object
AttributeHolder instances. Storing attribute values in
AttributeHolder has two advantage comparing to Map storage: 1) Attribute value is typed, and could
be checked at compile time. 2) Access to Attribute value, if used with IndexedAttributeHolder, could
be as fast as access to array.| Modifier | Constructor and Description |
|---|---|
protected |
Attribute(AttributeBuilder builder,
String name,
int index,
NullaryFunction<T> initializer) |
protected |
Attribute(AttributeBuilder builder,
String name,
int index,
T defaultValue) |
| Modifier and Type | Method and Description |
|---|---|
T |
get(AttributeHolder attributeHolder)
Get attribute value, stored on the
AttributeHolder. |
T |
get(AttributeStorage storage)
Get attribute value, stored on the
AttributeStorage. |
int |
index()
Return attribute name, which is used as attribute key on indexed
AttributeHolders. |
boolean |
isSet(AttributeHolder attributeHolder)
Checks if this attribute is set on the
AttributeHolder. |
boolean |
isSet(AttributeStorage storage)
Checks if this attribute is set on the
AttributeStorage. |
String |
name()
Return attribute name, which is used as attribute key on non-indexed
AttributeHolders. |
T |
peek(AttributeHolder attributeHolder)
Get attribute value, stored on the
AttributeHolder, the difference from
get(org.glassfish.grizzly.attributes.AttributeHolder) is that default value or NullaryFunction won't
be invoked. |
T |
peek(AttributeStorage storage)
Get attribute value, stored on the
AttributeStorage, the difference from get(AttributeStorage) is
that default value or NullaryFunction won't be invoked. |
T |
remove(AttributeHolder attributeHolder)
Remove attribute value, stored on the
AttributeHolder. |
T |
remove(AttributeStorage storage)
Remove attribute value, stored on the
AttributeStorage. |
void |
set(AttributeHolder attributeHolder,
T value)
Set attribute value, stored on the
AttributeHolder. |
void |
set(AttributeStorage storage,
T value)
Set attribute value, stored on the
AttributeStorage. |
String |
toString() |
protected Attribute(AttributeBuilder builder, String name, int index, T defaultValue)
protected Attribute(AttributeBuilder builder, String name, int index, NullaryFunction<T> initializer)
public T peek(AttributeHolder attributeHolder)
AttributeHolder, the difference from
get(org.glassfish.grizzly.attributes.AttributeHolder) is that default value or NullaryFunction won't
be invoked.attributeHolder - AttributeHolder.public T peek(AttributeStorage storage)
AttributeStorage, the difference from get(AttributeStorage) is
that default value or NullaryFunction won't be invoked.storage - AttributeStorage.public T get(AttributeHolder attributeHolder)
AttributeHolder.attributeHolder - AttributeHolder.public T get(AttributeStorage storage)
AttributeStorage.storage - AttributeStorage.public void set(AttributeHolder attributeHolder, T value)
AttributeHolder.attributeHolder - AttributeHolder.value - attribute value to set.public void set(AttributeStorage storage, T value)
AttributeStorage.storage - AttributeStorage.value - attribute value to set.public T remove(AttributeHolder attributeHolder)
AttributeHolder.attributeHolder - AttributeHolder.public T remove(AttributeStorage storage)
AttributeStorage.storage - AttributeStorage.public boolean isSet(AttributeHolder attributeHolder)
AttributeHolder. Returns true, if attribute is set, of
false otherwise.attributeHolder - AttributeHolder.public boolean isSet(AttributeStorage storage)
AttributeStorage. Returns true, if attribute is set, of
false otherwise.storage - AttributeStorage.public String name()
AttributeHolders.public int index()
AttributeHolders.Copyright © 2017–2020 Oracle Corporation. All rights reserved.