|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.smartlab.config.Element
public abstract class Element
This class identifies a configuration element which can in turn contains other configuration elements. An element is composed by a name, a set of attributes which can be empty and, optionally, by its contents.
Field Summary | |
---|---|
protected java.lang.String |
name
The element name. |
protected Node |
parent
The containing node. |
Constructor Summary | |
---|---|
protected |
Element(Node parent,
java.lang.String name)
Constructs an element with a givenparent node and name. |
Method Summary | |
---|---|
abstract java.lang.String |
getAttribute(java.lang.String name)
Returns the value of the attribute whose name equals the specified one or null if the element doesn't contain a such named
attribute. |
abstract java.util.Collection |
getAttributeNames()
Returns all the attributes names of this element. |
abstract java.util.Collection |
getAttributes()
Returns all the attributes of this element. |
java.util.Collection |
getAttributeValues(java.lang.String name)
Returns an unmodifiable Collection build on the attribute
value parsed as a comma separated list. |
abstract java.lang.String |
getContent()
Returns the element content as a string. |
Element |
getElement(java.lang.String name)
Returns the first contained element whose name equals the given one. |
Element |
getElement(java.lang.String name,
java.lang.String attribute)
Returns the first contained element whose name equals the given one and whose attribute list contains the given one. |
abstract Element |
getElement(java.lang.String name,
java.lang.String attribute,
java.lang.String value)
Returns the first contained element whose name equals the given one and whose attribute list defines an attribute whose name and values matches the given parameters. |
abstract java.util.Collection |
getElements()
Returns all the contained elements. |
abstract java.util.Collection |
getElements(java.lang.String name)
Returns all the contained elements which name equals the given one. |
abstract java.lang.String |
getId()
Returns the unique identifier associated with this element. |
java.lang.String |
getName()
Returns the name of this configuration element. |
abstract void |
resolve()
Resolves the element reference. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Node parent
protected java.lang.String name
Constructor Detail |
---|
protected Element(Node parent, java.lang.String name)
parent
- the node containing the element.name
- the element name.Method Detail |
---|
public java.lang.String getName()
String
representing the name of this
configuration element.public abstract java.lang.String getId()
public abstract java.util.Collection getElements() throws ConfigurationException
Collection
which enumerates the
contained elements.
ConfigurationException
- if something wrong occurs during the
operation.public abstract java.util.Collection getElements(java.lang.String name) throws ConfigurationException
name
- the name of the elements to search for.
Collection
which enumerates the
contained elements which name equals the given one.
ConfigurationException
- if something wrong occurs during the
operation.public Element getElement(java.lang.String name) throws ConfigurationException
name
- the name of the element to search for.
Element
or null
if
the search fails.
ConfigurationException
- if something wrong occurs during the
operation.public Element getElement(java.lang.String name, java.lang.String attribute) throws ConfigurationException
name
- the name of the element to search for.attribute
- the name of the attribute which must be defined on the
element.
Element
or null
if
the search fails.
ConfigurationException
- if something wrong occurs during the
operation.public abstract Element getElement(java.lang.String name, java.lang.String attribute, java.lang.String value) throws ConfigurationException
name
- the name of the element to search for.attribute
- attribute the name of the attribute which must be
defined on the element.value
- the value the attribute must match.
Element
or null
if
the search fails.
ConfigurationException
- if something wrong occurs during the
operation.public abstract java.util.Collection getAttributeNames() throws ConfigurationException
Collection
which enumerates the
attributes of this element.
ConfigurationException
- if something wrong occurs during the
operation.public abstract java.lang.String getAttribute(java.lang.String name) throws ConfigurationException
null
if the element doesn't contain a such named
attribute.
name
- the name of the attribute to get.
String
instance representing the attribute value
or null
if no attribute with the specified name
was found.
ConfigurationException
- if something wrong occurs during the
operation.public abstract java.util.Collection getAttributes() throws ConfigurationException
Collection
which enumerates the
attributes of this element.
ConfigurationException
- if something wrong occurs during the
operation.public java.util.Collection getAttributeValues(java.lang.String name) throws ConfigurationException
Collection
build on the attribute
value parsed as a comma separated list.
name
- the name of the attribute whose value will be parsed as a
comma separated list.
Collection
which enumerates the
attribute values parsed as a comma separated list.
ConfigurationException
- if something wrong occurs during the
operation.public abstract java.lang.String getContent() throws ConfigurationException
ConfigurationException
- if the content couldn't be retrieved.public abstract void resolve() throws ConfigurationException
ConfigurationException
- if something wrong occurs during the
operation.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |