com.waveset.object
Class SimpleProperties
java.lang.Object
java.util.AbstractMap
java.util.HashMap
com.waveset.object.SimpleProperties
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable, XmlObject
- public class SimpleProperties
- extends java.util.HashMap
- implements XmlObject
A class used to represent a collection of name/value pairs.
Similar to PropertyList except that values are restricted to strings,
and cannot be computed with expressions. This means we can use the
following serialization syntax:
<SimpleProperties>
property1=value1
property2=value2
</SimpleProperties>
- See Also:
- Serialized Form
Field Summary |
static java.lang.String |
code_id
|
static java.lang.String |
ELEMENT
The name of the default XML element used when serializing
this object. |
Method Summary |
boolean |
getBoolean(java.lang.String name)
|
java.lang.String |
getElementName()
Objects must provide the name of the XML element that will be used
in their serialized representation. |
int |
getInt(java.lang.String name)
|
int |
getInt(java.lang.String name,
int dflt)
|
java.lang.String |
getString(java.lang.String name)
|
void |
parseXml(org.w3c.dom.Element e)
|
java.lang.String |
toXml()
Objects must be able to render themselves as valid XML documents
including a header and DOCTYPE. |
void |
toXml(java.lang.StringBuffer b,
int indent)
Objects must be able to render themselves as XML into
a string buffer, with an optional amount of indentation. |
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
code_id
public static final java.lang.String code_id
- See Also:
- Constant Field Values
ELEMENT
public static final java.lang.String ELEMENT
- The name of the default XML element used when serializing
this object.
- See Also:
- Constant Field Values
SimpleProperties
public SimpleProperties()
SimpleProperties
public SimpleProperties(java.util.Properties p)
- Construct a
PropertyList
from an instance of java.util.Properties
.
SimpleProperties
public SimpleProperties(org.w3c.dom.Element e)
throws WavesetException
getElementName
public java.lang.String getElementName()
- Description copied from interface:
XmlObject
- Objects must provide the name of the XML element that will be used
in their serialized representation.
- Specified by:
getElementName
in interface XmlObject
- Returns:
- the element name
getString
public java.lang.String getString(java.lang.String name)
getBoolean
public boolean getBoolean(java.lang.String name)
getInt
public int getInt(java.lang.String name,
int dflt)
getInt
public int getInt(java.lang.String name)
parseXml
public void parseXml(org.w3c.dom.Element e)
throws WavesetException
- Throws:
WavesetException
toXml
public java.lang.String toXml()
- Description copied from interface:
XmlObject
- Objects must be able to render themselves as valid XML documents
including a header and DOCTYPE.
Normally this is implemented by AbstractXmlObject, which
also provides a static implementation toXml(XmlObject) which
may be called from classes that must implement this interface.
- Specified by:
toXml
in interface XmlObject
- Returns:
- the string representation of this object
toXml
public void toXml(java.lang.StringBuffer b,
int indent)
- Description copied from interface:
XmlObject
- Objects must be able to render themselves as XML into
a string buffer, with an optional amount of indentation.
This rendering should not include
an XML header or DOCTYPE. The indentation count should be handled
by XmlUtil.addIndent so we can globally turn indentation on or off.
- Specified by:
toXml
in interface XmlObject
- Parameters:
b
- target bufferindent
- amount of indentation