1 12 package org.displaytag.util; 13 14 import java.util.HashMap ; 15 import java.util.Iterator ; 16 import java.util.Map ; 17 import java.util.Set ; 18 19 20 25 public class HtmlAttributeMap extends HashMap 26 { 27 28 31 private static final long serialVersionUID = 899149338534L; 32 33 36 private static final char DELIMITER = '"'; 37 38 41 private static final char EQUALS = '='; 42 43 46 private static final char SPACE = ' '; 47 48 52 public String toString() 53 { 54 if (size() == 0) 56 { 57 return TagConstants.EMPTY_STRING; 58 } 59 60 StringBuffer buffer = new StringBuffer (size() * 30); 62 63 Set entrySet = entrySet(); 65 66 Iterator iterator = entrySet.iterator(); 67 68 while (iterator.hasNext()) 70 { 71 Map.Entry entry = (Map.Entry ) iterator.next(); 72 73 buffer 75 .append(SPACE) 76 .append(entry.getKey()) 77 .append(EQUALS) 78 .append(DELIMITER) 79 .append(entry.getValue()) 80 .append(DELIMITER); 81 } 82 83 return buffer.toString(); 85 } 86 } 87 | Popular Tags |