1 16 package org.directwebremoting; 17 18 import java.util.ArrayList ; 19 import java.util.List ; 20 21 31 public class ScriptBuffer 32 { 33 36 public ScriptBuffer() 37 { 38 } 39 40 45 public ScriptBuffer(String str) 46 { 47 appendScript(str); 48 } 49 50 55 public ScriptBuffer appendScript(String str) 56 { 57 parts.add(new StringWrapper(str)); 58 return this; 59 } 60 61 66 public ScriptBuffer appendData(boolean b) 67 { 68 Boolean data = b ? Boolean.TRUE : Boolean.FALSE; 69 parts.add(data); 70 return this; 71 } 72 73 78 public ScriptBuffer appendData(char c) 79 { 80 parts.add(new Character (c)); 81 return this; 82 } 83 84 89 public ScriptBuffer appendData(double d) 90 { 91 parts.add(new Double (d)); 92 return this; 93 } 94 95 100 public ScriptBuffer appendData(float f) 101 { 102 parts.add(new Float (f)); 103 return this; 104 } 105 106 111 public ScriptBuffer appendData(int i) 112 { 113 parts.add(new Integer (i)); 114 return this; 115 } 116 117 122 public ScriptBuffer appendData(long l) 123 { 124 parts.add(new Long (l)); 125 return this; 126 } 127 128 133 public ScriptBuffer appendData(Object obj) 134 { 135 parts.add(obj); 136 return this; 137 } 138 139 144 public ScriptBuffer appendData(String str) 145 { 146 parts.add(str); 147 return this; 148 } 149 150 153 public String toString() 154 { 155 return parts.toString(); 156 } 157 158 163 public List getParts() 164 { 165 return parts; 166 } 167 168 172 public class StringWrapper 173 { 174 StringWrapper(String data) 175 { 176 this.data = data; 177 } 178 179 String data; 180 181 184 public String toString() 185 { 186 return data; 187 } 188 } 189 190 193 private List parts = new ArrayList (); 194 } 195 | Popular Tags |