|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthmi.xml.XMLAttributeMap
public class XMLAttributeMap
parlevink.xml.XMLAttributeMap is like java.util.properties, except that it is not limited to String-typed keys and values, and it is based on HashMaps, rather than Hashtables. Keys take the form of Id's or Strings, although internally Id's are used. For storing/retrieving Object-typed values, the prime methods are setAttribute(id, value) and getAttribute(id). When values are known to be Strings, the preferred methods are setString(id, string) and getString(id). In all cases, "id" can be an Id, or it can be a String.
| Field Summary | |
|---|---|
private LinkedHashMap<String,Object> |
attr
|
static String |
ATTRIBUTEMAPTAG
|
private StringBuilder |
buf
|
private static int |
BUFLEN
the (initial) length of the StringBuilder used for readXML(in). |
static String |
CLASSNAME
|
private static int |
ENCODEBUFSIZE
|
private String |
encoding
|
static int |
TAB
|
static String |
WRAPPEDCLASSNAME
|
private static String |
XMLTAG
|
| Constructor Summary | |
|---|---|
XMLAttributeMap()
creates a new, empty set of attributes. |
|
XMLAttributeMap(int initialCapacity)
creates a new, empty set of attributes. |
|
| Method Summary | |
|---|---|
private void |
appendSpace(StringBuilder buf,
int nsp)
|
StringBuilder |
appendXML(StringBuilder buf)
appends the value of this XMLList to buf. |
StringBuilder |
appendXML(StringBuilder buf,
int tab)
appends the value of this XMLList to buf. |
StringBuilder |
appendXML(StringBuilder buf,
XMLFormatting fmt)
appends the value of this XMLList to buf. |
Iterator<String> |
attributeNames()
Returns an Iterator for all the property attribute keys. |
Iterator<Object> |
attributeValues()
Returns an Iterator for all the attribute values. |
private void |
clearBuf(int len)
|
private void |
encode(int tab)
|
boolean |
equals(Object attributeMap)
|
Object |
getAttribute(String key)
retrieves the (Object-typed) value of the attribute identified by key. |
String |
getString(String key)
retrieves the String-typed value of the attribute identified by key. |
String |
getXMLTag()
returns the XML tag that is used to encode this type of XMLStructure. |
boolean |
hasAttribute(String key)
checks whether an attribute for "key" has been defined. |
int |
hashCode()
|
protected Iterator<Map.Entry<String,Object>> |
iterator()
|
XMLStructure |
readXML(Reader in)
reconstructs this XMLList object by reading and parsing XML encoded data Data is read until the end of data is reached, or until a '<' character is read. |
XMLStructure |
readXML(String s)
reconstructs this XMLLIst object by parsing an XML encoded String s This method can throw an (unchecked) XMLScanException in case of incorrectly formatted XML. |
XMLStructure |
readXML(XMLTokenizer tokenizer)
reconstructs this XMLList using a XMLTokenizer. |
Object |
setAttribute(String key,
Object value)
sets the value of the attribute identified by "key". |
Object |
setString(String key,
String value)
sets the String-typed value of the attribute identified by "key". |
String |
toString()
|
String |
toXMLString()
yields an XML encoded String of this XMLIzable object. |
String |
toXMLString(int tab)
yields an XML encoded String of this XMLIzable object. |
String |
toXMLString(XMLFormatting fmt)
yields an XML encoded String of this XMLIzable object. |
void |
writeXML(PrintWriter out)
writes the value of this XMLList to out. |
void |
writeXML(PrintWriter out,
int tab)
writes the value of this XMLList to out. |
void |
writeXML(PrintWriter out,
XMLFormatting fmt)
writes the value of this XMLList to out. |
static String |
xmlTag()
The XML Stag for XML encoding -- use this static method when you want to see if a given String equals the xml tag for this class |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final int ENCODEBUFSIZE
private LinkedHashMap<String,Object> attr
private static final int BUFLEN
private String encoding
private StringBuilder buf
public static final int TAB
public static final String ATTRIBUTEMAPTAG
private static final String XMLTAG
public static final String CLASSNAME
public static final String WRAPPEDCLASSNAME
| Constructor Detail |
|---|
public XMLAttributeMap()
public XMLAttributeMap(int initialCapacity)
| Method Detail |
|---|
public Object setAttribute(String key,
Object value)
public Object getAttribute(String key)
public Object setString(String key,
String value)
public String getString(String key)
public boolean hasAttribute(String key)
public Iterator<String> attributeNames()
public Iterator<Object> attributeValues()
protected Iterator<Map.Entry<String,Object>> iterator()
private void appendSpace(StringBuilder buf,
int nsp)
private void encode(int tab)
public XMLStructure readXML(String s)
readXML in interface XMLStructure
public XMLStructure readXML(Reader in)
throws IOException
readXML in interface XMLStructureIOExceptionpublic XMLStructure readXML(XMLTokenizer tokenizer)
readXML in interface XMLStructurepublic void writeXML(PrintWriter out)
writeXML in interface XMLStructure
public void writeXML(PrintWriter out,
int tab)
writeXML in interface XMLStructure
public void writeXML(PrintWriter out,
XMLFormatting fmt)
writeXML in interface XMLStructurepublic StringBuilder appendXML(StringBuilder buf)
appendXML in interface XMLStructure
public StringBuilder appendXML(StringBuilder buf,
XMLFormatting fmt)
appendXML in interface XMLStructure
public StringBuilder appendXML(StringBuilder buf,
int tab)
appendXML in interface XMLStructurepublic String toXMLString()
toXMLString in interface XMLStructurepublic String toXMLString(XMLFormatting fmt)
toXMLString in interface XMLStructurepublic String toXMLString(int tab)
toXMLString in interface XMLStructurepublic String toString()
toString in class Objectpublic boolean equals(Object attributeMap)
equals in class Objectpublic int hashCode()
hashCode in class Objectprivate void clearBuf(int len)
public String getXMLTag()
getXMLTag in interface XMLStructurepublic static String xmlTag()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||