01: package com.jeta.forms.store.xml.parser;
02:
03: public class PrimitiveHolderHandler extends ObjectHandler {
04:
05: public Object getObject() {
06: String classname = (String) getProperty("primitive");
07: String value = (String) getProperty("value");
08: if ("java.lang.Byte".equals(classname)) {
09: return new Byte(value);
10: } else if ("java.lang.Boolean".equals(classname)) {
11: return new Boolean(value);
12: } else if ("java.lang.Character".equals(classname)) {
13: if (value == null || value.length() == 0)
14: return new Character('\0');
15: else
16: return new Character(value.charAt(0));
17: } else if ("java.lang.Short".equals(classname)) {
18: return new Short(value);
19: } else if ("java.lang.Integer".equals(classname)) {
20: return new Integer(value);
21: } else if ("java.lang.Long".equals(classname)) {
22: return new Long(value);
23: } else if ("java.lang.Float".equals(classname)) {
24: return new Float(value);
25: } else if ("java.lang.Double".equals(classname)) {
26: return new Double(value);
27: } else {
28: assert (false);
29: return null;
30: }
31: }
32: }
|