|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.attributes.Attribute<T>
public class Attribute<T>
Class used to define dynamic typed attributes on AttributeHolder
instances.
Storing attribute values in AttributeHolder has two advantage
comparing to Map storage:
1) Attribute value is typed, and could be checked at
compiletime.
2) Access to Attribute value, if used with
IndexedAttributeHolder, could be as fast as access to array.
| Constructor Summary | |
|---|---|
protected |
Attribute(AttributeBuilder builder,
String name,
NullaryFunction<T> initializer)
|
protected |
Attribute(AttributeBuilder builder,
String name,
T defaultValue)
|
| Method Summary | |
|---|---|
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 |
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. |
protected void |
setIndex(int index)
Assign integer index to Attribute, to make access to its value
as fast as array[index]. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Attribute(AttributeBuilder builder,
String name,
T defaultValue)
protected Attribute(AttributeBuilder builder,
String name,
NullaryFunction<T> initializer)
| Method Detail |
|---|
public String toString()
toString in class Objectpublic 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.
protected void setIndex(int index)
Attribute, to make access to its value
as fast as array[index].
index - attribute index.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||