org.yawlfoundation.yawl.elements
Class YAttributeMap

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<String,String>
          extended by org.yawlfoundation.yawl.elements.YAttributeMap
All Implemented Interfaces:
Serializable, Cloneable, Map<String,String>

public class YAttributeMap
extends Hashtable<String,String>

An extended Hashtable of key=attribute pairs.

Since:
2.1
Author:
Michael Adams
See Also:
Serialized Form
Created/Last Date:
11/11/2009

Constructor Summary
YAttributeMap()
          Construct an (initially) empty attribute map.
YAttributeMap(Map<String,String> attributes)
          Construct an attribute map, and initialise it with the specified attributes.
 
Method Summary
 void fromJDOM(List jdomAttributes)
          Replace the stored attributes (if any) with the JDOM attributes specified.
 boolean getBoolean(String key)
          Get the boolean value matching the stored key.
 void set(Map<String,String> attributes)
          Replace the stored attributes (if any) with those specified.
 Set<org.jdom.Attribute> toJDOM()
          Get the contents of the attribute map as a set of JDOM attributes.
 String toXML()
          Write the full set of attributes stored in the map, in XML attribute format, for insertion into an XML element.
 String toXML(String key)
          Write a specified key=value pair in XML attribute format: key="value"
 String toXMLElement(String key)
          Write a specified key=value pair in XML element format: <key>value</key>
 String toXMLElements()
          Write the full set of attributes stored in the map, in XML element format.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

YAttributeMap

public YAttributeMap()
Construct an (initially) empty attribute map.


YAttributeMap

public YAttributeMap(Map<String,String> attributes)
Construct an attribute map, and initialise it with the specified attributes.

Parameters:
attributes - a map of key=value pairs to initialise the map.
Method Detail

set

public void set(Map<String,String> attributes)
Replace the stored attributes (if any) with those specified.

Parameters:
attributes - a map of key=value pairs to place in this map, replacing any previous contents.

getBoolean

public boolean getBoolean(String key)
Get the boolean value matching the stored key.

Parameters:
key - the attribute key to retrieve the value of.
Returns:
true iff the attribute map contains a key matching the String specified AND that attribute key has a corresponding value that matches the String "true" (case-insensitive).

toJDOM

public Set<org.jdom.Attribute> toJDOM()
Get the contents of the attribute map as a set of JDOM attributes.

Returns:
a Set of populated JDOM Attribute objects.

fromJDOM

public void fromJDOM(List jdomAttributes)
Replace the stored attributes (if any) with the JDOM attributes specified.

Parameters:
jdomAttributes - a List of JDOM Attribute objects to convert to key=value pairs and place in this map, replacing any previous contents.

toXML

public String toXML(String key)
Write a specified key=value pair in XML attribute format: key="value"

Parameters:
key - the key to write out, with its corresponding value.
Returns:
if the key exists in the attribute map, a representation of it in XML attribute format, otherwise an empty String.

toXMLElement

public String toXMLElement(String key)
Write a specified key=value pair in XML element format: <key>value</key>

Parameters:
key - the key to write out, with its corresponding value.
Returns:
if the key exists in the attribute map, a representation of it in XML element format, otherwise an empty String.

toXML

public String toXML()
Write the full set of attributes stored in the map, in XML attribute format, for insertion into an XML element.

Returns:
a space separated list of this attribute map's key="value" pairs.

toXMLElements

public String toXMLElements()
Write the full set of attributes stored in the map, in XML element format.

Returns:
a space separated list of this attribute map's <key>value</key> pairs.


Copyright © 2004-2012 The YAWL Foundation.