AbstractXMLNode.java

Go to the documentation of this file.
00001 package de.mfuchs.xmlstorage;
00002 
00003 import java.math.BigDecimal;
00004 
00005 
00006 /**
00007  * AbstractXMLNode is the base class of XMLNode and XMLStreamNode.
00008  * @author martin
00009  */
00010 public abstract class AbstractXMLNode
00011 {
00012     public abstract String getName();
00013 
00014     /// read only access to an attribute
00015     public abstract String get(final String attrName);
00016 
00017     /// read only access to an attribute with default value
00018     public abstract String get(final String attrName, final String def);
00019 
00020     public abstract String getContent();
00021 
00022     public abstract String toString();
00023 
00024     public XMLInt getInt(final String attrName)
00025     {
00026         return new XMLInt(this, attrName);
00027     }
00028     public XMLInt getInt(final String attrName, int def)
00029     {
00030         return new XMLInt(this, attrName, def);
00031     }
00032 
00033     public XMLNumber getNumber(final String attrName)
00034     {
00035         return new XMLNumber(this, attrName);
00036     }
00037     public XMLNumber getNumber(final String attrName, BigDecimal def)
00038     {
00039         return new XMLNumber(this, attrName, def);
00040     }
00041 
00042     public XMLBool getBool(final String attrName)
00043     {
00044         return new XMLBool(this, attrName);
00045     }
00046     public XMLBool getBool(final String attrName, boolean def)
00047     {
00048         return new XMLBool(this, attrName, def);
00049     }
00050 
00051     public XMLString getString(final String attrName)
00052     {
00053         return new XMLString(this, attrName);
00054     }
00055     public XMLString getString(final String attrName, final String def)
00056     {
00057         return new XMLString(this, attrName, def);
00058     }
00059 }