org.iges.anagram
Class Setting

java.lang.Object
  |
  +--org.iges.anagram.Setting
Direct Known Subclasses:
Privilege

public class Setting
extends java.lang.Object

An encapsulation of XML tag data from the server's configuration file. Each Setting object provides access to the attributes and subtags of a single XML tag.


Field Summary
protected  org.w3c.dom.Element xml
           
 
Constructor Summary
Setting(org.w3c.dom.Element xml)
          Creates a Setting object from the given XML tag.
Setting(java.lang.String name, org.w3c.dom.Document document)
          Creates a Setting object from the top-level tag of the given XML document.
 
Method Summary
 java.lang.String getAttribute(java.lang.String name)
          Returns the value of the named attribute of this tag.
 java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)
          Returns the value of the named attribute of this tag.
 java.lang.String getName()
          Returns the name of this XML tag
 long getNumAttribute(java.lang.String name, long defaultValue)
          Returns the numerical value of the named attribute of this tag.
 java.util.List getSubSettings()
          Returns a list of Setting objects representing all sub-tags of this XML tag.
 java.util.List getSubSettings(java.lang.String name)
          Returns a list of Setting objects representing all sub-tags of this XML tag with the given name.
 Setting getUniqueSubSetting(java.lang.String name)
          Returns the sub-tag of this XML tag with the given name.
 org.w3c.dom.Element getXML()
          Returns the DOM interface to the XML tag associated with this Setting.
 java.lang.String toString()
           
protected  org.w3c.dom.Element uniqueElement(java.lang.String name, org.w3c.dom.Document document, org.w3c.dom.NodeList tagList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xml

protected org.w3c.dom.Element xml
Constructor Detail

Setting

public Setting(org.w3c.dom.Element xml)
Creates a Setting object from the given XML tag.


Setting

public Setting(java.lang.String name,
               org.w3c.dom.Document document)
        throws AnagramException
Creates a Setting object from the top-level tag of the given XML document.

Parameters:
name - The name of the top-level tag
Method Detail

getName

public java.lang.String getName()
Returns the name of this XML tag


getSubSettings

public java.util.List getSubSettings(java.lang.String name)
Returns a list of Setting objects representing all sub-tags of this XML tag with the given name.


getSubSettings

public java.util.List getSubSettings()
Returns a list of Setting objects representing all sub-tags of this XML tag.


getUniqueSubSetting

public Setting getUniqueSubSetting(java.lang.String name)
                            throws AnagramException
Returns the sub-tag of this XML tag with the given name.

Throws:
AnagramException - If more than one sub-tag exists with that name.

getXML

public org.w3c.dom.Element getXML()
Returns the DOM interface to the XML tag associated with this Setting.


getNumAttribute

public long getNumAttribute(java.lang.String name,
                            long defaultValue)
Returns the numerical value of the named attribute of this tag.

Parameters:
defaultValue - Returned if the tag has no such attribute, or the attribute's value is non-numeric.

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Returns the value of the named attribute of this tag. Returns "" if the tag has no such attribute.


getAttribute

public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String defaultValue)
Returns the value of the named attribute of this tag.

Parameters:
defaultValue - Returned if the tag has no such attribute.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

uniqueElement

protected org.w3c.dom.Element uniqueElement(java.lang.String name,
                                            org.w3c.dom.Document document,
                                            org.w3c.dom.NodeList tagList)
                                     throws AnagramException
AnagramException