|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Attributed
Attributed object is a Java object decorated by attributes. Each attribute has a name and value. A name of an attribute is a string.
There are two kinds of attributes: simple and indexed attributes. Simple attribute has a single value that may be retrieved or modified. Indexed attribute is a list of values that can be accessed by integer index. Indexed attribute can be considered as simple. In this case a value of an attribute is an entire list.
For example, this interface can be implemented:
TODO: add mapped attributes as in org.apache.commons.beanutils
Method Summary | |
---|---|
void |
addAttribute(String name,
Object value)
Adds an attribute with the specified name and value. |
Object |
getAttribute(String name)
Retrieves the value of a simple attribute with the specified name. |
Object |
getAttribute(String name,
int index)
Retrieves the value of the specified element of an indexed attribute with the specified name. |
Set |
getAttributeNames()
Returns the names of all attributes. |
boolean |
hasAttribute(String name)
Checks existence of an attribute with the specified name. |
boolean |
isAttrCreatable()
Checks whether attributes may be created dynamically. |
boolean |
isIndexed(String name)
Checks whether an attribute with the specified name may be indexed. |
boolean |
isRemovable(String name)
Checks whether an attribute with the specified name may be removed dynamically. |
boolean |
isWritable(String name)
Checks whether a value of an attribute with the specified name may be changed. |
void |
removeAttribute(String name)
Removes an attribute with the specified name. |
void |
setAttribute(String name,
int index,
Object elem)
Changes the value of the specified element of an indexed attribute with the specified name. |
void |
setAttribute(String name,
Object value)
Changes the value of a simple attribute with the specified name. |
int |
sizeAttribute(String name)
Returns the size of an indexed attribute with the specified name. |
Method Detail |
---|
boolean hasAttribute(String name)
name
- The name of an attribute.
true
if there exists an attribute with
the specified name, false
otherwise.
NullPointerException
- If name
is null
.boolean isAttrCreatable()
true
if attributes may be created
dynamically, false
otherwise.boolean isRemovable(String name)
name
- The name of an attribute.
true
if an attribute with
the specified name may be removed dynamically,
false
otherwise.
AttributeException
- Some possible reasons:
name == null
hasAttribute(String)
boolean isWritable(String name)
name
- The name of an attribute.
true
if a value of an attribute with
the specified name may be changed,
false
otherwise.
AttributeException
- Some possible reasons:
name == null
hasAttribute(String)
boolean isIndexed(String name)
name
- The name of an attribute
true
if a value of an attribute with
the specified name may be indexed,
false
otherwise.
AttributeException
- Some possible reasons:
name == null
hasAttribute(String)
void addAttribute(String name, Object value)
name
- The name of new attribute.value
- The value of new attribute.
UnsupportedOperationException
- if {link #isAttrCreatable()} returns false
AttributeException
- Some possible reasons:
name == null
hasAttribute(String)
void removeAttribute(String name)
name
- The name of an attribute.
UnsupportedOperationException
- if operation is not supported
AttributeException
- Some possible reasons:
name == null
hasAttribute(String)
,
isRemovable(String)
Object getAttribute(String name)
name
- The name of an attribute.
AttributeException
- Some possible reasons:
name == null
hasAttribute(String)
void setAttribute(String name, Object value)
name
- The name of an attribute.value
- The new value of an attribute.
AttributeException
- Some possible reasons:
name == null
value
hasAttribute(String)
,
isWritable(String)
int sizeAttribute(String name)
name
- The name of an indexed attribute.
AttributeException
- Some possible reasons:
name == null
hasAttribute(String)
,
isIndexed(String)
Object getAttribute(String name, int index)
name
- The name of an indexed attribute.index
- The index of an indexed attribute.
AttributeException
- Some possible reasons:
name == null
hasAttribute(String)
,
isIndexed(String)
,
sizeAttribute(String)
void setAttribute(String name, int index, Object elem)
name
- The name of an indexed attribute.index
- The index of an indexed attribute.elem
- The new value of an element with the specified index.
AttributeException
- Some possible reasons:
name == null
elem
hasAttribute(String)
,
isWritable(String)
,
isIndexed(String)
,
sizeAttribute(String)
Set getAttributeNames()
Map.keySet()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |