net.smartlab.config
Class Reference

java.lang.Object
  extended by net.smartlab.config.Element
      extended by net.smartlab.config.Reference

public class Reference
extends Element

Author:
rlogiacco

Field Summary
protected  java.lang.String id
          The unique identifier for this reference.
protected static java.lang.String IDENTIFIER
          The name of the element attribute defining a valid reference target.
protected  Node node
          The referenced node.
protected static java.lang.String REFERENCE
          The name of the element attribute defining a reference to another element.
 
Fields inherited from class net.smartlab.config.Element
name, parent
 
Constructor Summary
protected Reference(Node parent, java.lang.String name, java.lang.String id)
          Creates a reference contained by the given parent node with a specified name and unique identifier.
 
Method Summary
 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.
 java.util.Collection getAttributeNames()
          Returns all the attributes names of this element.
 java.util.Collection getAttributes()
          Returns all the attributes of this element.
 java.lang.String getContent()
          Returns the element content as a string.
 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.
 java.util.Collection getElements()
          Returns all the contained elements.
 java.util.Collection getElements(java.lang.String name)
          Returns all the contained elements which name equals the given one.
 java.lang.String getId()
          Returns the unique identifier associated with this element.
 void resolve()
          Resolves the element reference.
 
Methods inherited from class net.smartlab.config.Element
getAttributeValues, getElement, getElement, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REFERENCE

protected static final java.lang.String REFERENCE
The name of the element attribute defining a reference to another element.

See Also:
Constant Field Values

IDENTIFIER

protected static final java.lang.String IDENTIFIER
The name of the element attribute defining a valid reference target.

See Also:
Constant Field Values

node

protected Node node
The referenced node. It will be null until resolved.


id

protected java.lang.String id
The unique identifier for this reference.

Constructor Detail

Reference

protected Reference(Node parent,
                    java.lang.String name,
                    java.lang.String id)
Creates a reference contained by the given parent node with a specified name and unique identifier.

Parameters:
parent - the node containing the element.
name - the element name.
id - the element identifier.
Method Detail

getId

public java.lang.String getId()
Description copied from class: Element
Returns the unique identifier associated with this element.

Specified by:
getId in class Element
Returns:
the unique identifier associated with this element.
See Also:
Element.getId()

getElements

public java.util.Collection getElements()
                                 throws ConfigurationException
Description copied from class: Element
Returns all the contained elements.

Specified by:
getElements in class Element
Returns:
an unmodifiable Collection which enumerates the contained elements.
Throws:
ConfigurationException - if something wrong occurs during the operation.
See Also:
Element.getElements()

getElements

public java.util.Collection getElements(java.lang.String name)
                                 throws ConfigurationException
Description copied from class: Element
Returns all the contained elements which name equals the given one.

Specified by:
getElements in class Element
Parameters:
name - the name of the elements to search for.
Returns:
an unmodifiable Collection which enumerates the contained elements which name equals the given one.
Throws:
ConfigurationException - if something wrong occurs during the operation.
See Also:
Element.getElements(java.lang.String)

getElement

public Element getElement(java.lang.String name,
                          java.lang.String attribute,
                          java.lang.String value)
                   throws ConfigurationException
Description copied from class: Element
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.

Specified by:
getElement in class Element
Parameters:
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.
Returns:
the contained Element or null if the search fails.
Throws:
ConfigurationException - if something wrong occurs during the operation.
See Also:
Element.getElement(java.lang.String, java.lang.String, java.lang.String)

getAttributes

public java.util.Collection getAttributes()
                                   throws ConfigurationException
Description copied from class: Element
Returns all the attributes of this element.

Specified by:
getAttributes in class Element
Returns:
an unmodifiable Collection which enumerates the attributes of this element.
Throws:
ConfigurationException - if something wrong occurs during the operation.
See Also:
Element.getAttributes()

getAttributeNames

public java.util.Collection getAttributeNames()
                                       throws ConfigurationException
Description copied from class: Element
Returns all the attributes names of this element.

Specified by:
getAttributeNames in class Element
Returns:
an unmodifiable Collection which enumerates the attributes of this element.
Throws:
ConfigurationException - if something wrong occurs during the operation.
See Also:
Element.getAttributeNames()

getAttribute

public java.lang.String getAttribute(java.lang.String name)
                              throws ConfigurationException
Description copied from class: Element
Returns the value of the attribute whose name equals the specified one or null if the element doesn't contain a such named attribute.

Specified by:
getAttribute in class Element
Parameters:
name - the name of the attribute to get.
Returns:
a String instance representing the attribute value or null if no attribute with the specified name was found.
Throws:
ConfigurationException - if something wrong occurs during the operation.
See Also:
Element.getAttribute(java.lang.String)

getContent

public java.lang.String getContent()
                            throws ConfigurationException
Description copied from class: Element
Returns the element content as a string.

Specified by:
getContent in class Element
Returns:
the characters contained between the tag boundaries.
Throws:
ConfigurationException - if the content couldn't be retrieved.
See Also:
Element.getContent()

resolve

public void resolve()
             throws ConfigurationException
Description copied from class: Element
Resolves the element reference.

Specified by:
resolve in class Element
Throws:
ConfigurationException - if something wrong occurs during the operation.
See Also:
Element.resolve()


Copyright © 2002-2008 SmartLab s.r.l.. All Rights Reserved.