org.displaytag.util
public class: HtmlAttributeMap [javadoc |
source]
java.lang.Object
java.util.AbstractMap
java.util.HashMap
org.displaytag.util.HtmlAttributeMap
All Implemented Interfaces:
Map, Serializable, Cloneable
Extends Map providing only a different toString() method which can be used in printing attributes inside an html tag.
- author:
Fabrizio - Giustina
- version:
$ - Revision: 1081 $ ($Author: fgiust $)
| Method from org.displaytag.util.HtmlAttributeMap Summary: |
|---|
|
toString |
| Methods from java.util.HashMap: |
|---|
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
| Methods from java.util.AbstractMap: |
|---|
|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values |
| Method from org.displaytag.util.HtmlAttributeMap Detail: |
public String toString() {
// fast exit when no attribute are present
if (size() == 0)
{
return TagConstants.EMPTY_STRING;
}
// buffer extimated in number of attributes * 30
StringBuffer buffer = new StringBuffer(size() * 30);
// get the entrySet
Set entrySet = entrySet();
Iterator iterator = entrySet.iterator();
// iterates on attributes
while (iterator.hasNext())
{
Map.Entry entry = (Map.Entry) iterator.next();
// append a new atribute
buffer
.append(SPACE)
.append(entry.getKey())
.append(EQUALS)
.append(DELIMITER)
.append(entry.getValue())
.append(DELIMITER);
}
// return
return buffer.toString();
}
toString method: returns attributes in the format: attributename="attributevalue" attr2="attrValue2" ... |