Class XMLObject

Direct Known Subclasses:
BasePhase, BasicGroupList, BasicPlayer, OwnedObject

public class XMLObject
extends java.lang.Object

XMLObject is a simple object with a Name attribute and an element that contains information about that entity. Is used as a base class for more specific objects. NOTE : In general all set methods will create an element of that type if one doesn't exist, while get methods throw NoSuchElement execeptions on unknown settings. getBoolean however returns false if the setting is not found.

Field Summary
protected  org.jdom.Element info
          info contains the info block that holds the XML representation of the object
Constructor Summary
XMLObject(org.jdom.Element e)
Method Summary
 void addElement(org.jdom.Element e)
 org.jdom.Element getElement(java.lang.String name)
 org.jdom.Element getInfo()
 int getIntSetting(java.lang.String setting)
 java.util.Iterator getIterator(java.lang.String children)
 java.lang.String getName()
 java.lang.String getSetting(java.lang.String setting)
 boolean isSetting(java.lang.String setting)
          Returns boolean true if the settings equals 'true', if otherwise false.
 void setBooleanSetting(java.lang.String setting, boolean value)
 void setInfo(org.jdom.Element info)
 void setIntSetting(java.lang.String setting, int value)
 void setName(java.lang.String name)
 void setSetting(java.lang.String setting, java.lang.String value)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected org.jdom.Element info
info contains the info block that holds the XML representation of the object
Constructor Detail


public XMLObject(org.jdom.Element e)
Method Detail


public java.lang.String getName()
The NAME of the object


public void setName(java.lang.String name)
name - The String NAME of the object.


public java.lang.String getSetting(java.lang.String setting)
                            throws java.util.NoSuchElementException
settings - The String name of the setting required
A new String containing the value of the setting


public void setSetting(java.lang.String setting,
                       java.lang.String value)
                throws java.util.NoSuchElementException
setting - The String name of the setting to change or create
value - The String value to set the setting to.


public int getIntSetting(java.lang.String setting)
                  throws java.util.NoSuchElementException


public void setIntSetting(java.lang.String setting,
                          int value)
                   throws java.util.NoSuchElementException


public org.jdom.Element getElement(java.lang.String name)


public java.util.Iterator getIterator(java.lang.String children)


public org.jdom.Element getInfo()


public void setInfo(org.jdom.Element info)


public boolean isSetting(java.lang.String setting)
Returns boolean true if the settings equals 'true', if otherwise false. NOTE that unfound element return false.


public void setBooleanSetting(java.lang.String setting,
                              boolean value)


public void addElement(org.jdom.Element e)

Freya Engine, The Turn Based Game Engine
Copyright(c) 2002 Alexander Bilton
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA