1 2 18 19 22 package org.quartz; 23 24 import java.io.Serializable ; 25 import java.util.Map ; 26 27 import org.quartz.utils.StringKeyDirtyFlagMap; 28 29 62 public class JobDataMap extends StringKeyDirtyFlagMap implements Serializable { 63 64 private static final long serialVersionUID = -6939901990106713909L; 65 66 73 74 79 public JobDataMap() { 80 super(15); 81 } 82 83 88 public JobDataMap(Map map) { 89 this(); 90 91 putAll(map); 92 } 93 94 101 102 108 public void putAsString(String key, boolean value) { 109 String strValue = new Boolean (value).toString(); 110 111 super.put(key, strValue); 112 } 113 114 120 public void putAsString(String key, Boolean value) { 121 String strValue = value.toString(); 122 123 super.put(key, strValue); 124 } 125 126 132 public void putAsString(String key, char value) { 133 String strValue = new Character (value).toString(); 134 135 super.put(key, strValue); 136 } 137 138 144 public void putAsString(String key, Character value) { 145 String strValue = value.toString(); 146 147 super.put(key, strValue); 148 } 149 150 156 public void putAsString(String key, double value) { 157 String strValue = new Double (value).toString(); 158 159 super.put(key, strValue); 160 } 161 162 168 public void putAsString(String key, Double value) { 169 String strValue = value.toString(); 170 171 super.put(key, strValue); 172 } 173 174 180 public void putAsString(String key, float value) { 181 String strValue = new Float (value).toString(); 182 183 super.put(key, strValue); 184 } 185 186 192 public void putAsString(String key, Float value) { 193 String strValue = value.toString(); 194 195 super.put(key, strValue); 196 } 197 198 204 public void putAsString(String key, int value) { 205 String strValue = new Integer (value).toString(); 206 207 super.put(key, strValue); 208 } 209 210 216 public void putAsString(String key, Integer value) { 217 String strValue = value.toString(); 218 219 super.put(key, strValue); 220 } 221 222 228 public void putAsString(String key, long value) { 229 String strValue = new Long (value).toString(); 230 231 super.put(key, strValue); 232 } 233 234 240 public void putAsString(String key, Long value) { 241 String strValue = value.toString(); 242 243 super.put(key, strValue); 244 } 245 246 254 public int getIntFromString(String key) { 255 Object obj = get(key); 256 257 return new Integer ((String ) obj).intValue(); 258 } 259 260 268 public long getIntValue(String key) { 269 Object obj = get(key); 270 271 if(obj instanceof String ) { 272 return getIntFromString(key); 273 } else { 274 return getInt(key); 275 } 276 } 277 278 286 public Integer getIntegerFromString(String key) { 287 Object obj = get(key); 288 289 return new Integer ((String ) obj); 290 } 291 292 300 public boolean getBooleanValueFromString(String key) { 301 Object obj = get(key); 302 303 return new Boolean ((String ) obj).booleanValue(); 304 } 305 306 315 public boolean getBooleanValue(String key) { 316 Object obj = get(key); 317 318 if(obj instanceof String ) { 319 return getBooleanValueFromString(key); 320 } else { 321 return getBoolean(key); 322 } 323 } 324 325 333 public Boolean getBooleanFromString(String key) { 334 Object obj = get(key); 335 336 return new Boolean ((String ) obj); 337 } 338 339 347 public char getCharFromString(String key) { 348 Object obj = get(key); 349 350 return ((String ) obj).charAt(0); 351 } 352 353 361 public Character getCharacterFromString(String key) { 362 Object obj = get(key); 363 364 return new Character (((String ) obj).charAt(0)); 365 } 366 367 375 public double getDoubleValueFromString(String key) { 376 Object obj = get(key); 377 378 return new Double ((String ) obj).doubleValue(); 379 } 380 381 389 public double getDoubleValue(String key) { 390 Object obj = get(key); 391 392 if(obj instanceof String ) { 393 return getDoubleValueFromString(key); 394 } else { 395 return getDouble(key); 396 } 397 } 398 399 407 public Double getDoubleFromString(String key) { 408 Object obj = get(key); 409 410 return new Double ((String ) obj); 411 } 412 413 421 public float getFloatValueFromString(String key) { 422 Object obj = get(key); 423 424 return new Float ((String ) obj).floatValue(); 425 } 426 427 435 public float getFloatValue(String key) { 436 Object obj = get(key); 437 438 if(obj instanceof String ) { 439 return getFloatValueFromString(key); 440 } else { 441 return getFloat(key); 442 } 443 } 444 445 453 public Float getFloatFromString(String key) { 454 Object obj = get(key); 455 456 return new Float ((String ) obj); 457 } 458 459 467 public long getLongValueFromString(String key) { 468 Object obj = get(key); 469 470 return new Long ((String ) obj).longValue(); 471 } 472 473 481 public long getLongValue(String key) { 482 Object obj = get(key); 483 484 if(obj instanceof String ) { 485 return getLongValueFromString(key); 486 } else { 487 return getLong(key); 488 } 489 } 490 491 499 public Long getLongFromString(String key) { 500 Object obj = get(key); 501 502 return new Long ((String ) obj); 503 } 504 } 505 | Popular Tags |