1 29 30 package com.caucho.config.jaxb; 31 32 import com.caucho.config.ConfigException; 33 import com.caucho.config.NodeBuilder; 34 import com.caucho.xml.QName; 35 36 import org.w3c.dom.Node ; 37 38 import java.lang.reflect.Field ; 39 40 class IntField extends JaxbProperty { 41 private final Field _field; 42 43 IntField(Field field) 44 { 45 _field = field; 46 } 47 48 56 public void configureAttribute(NodeBuilder builder, 57 Object bean, 58 QName name, 59 String value) 60 throws ConfigException 61 { 62 } 63 64 72 public void configureElement(NodeBuilder builder, 73 Object bean, 74 QName name, 75 Node node) 76 throws ConfigException 77 { 78 String textValue = node.getTextContent().trim(); 79 80 long value = evalLong(builder, textValue); 81 82 try { 83 _field.set(bean, new Integer ((int) value)); 84 } catch (IllegalAccessException e) { 85 throw builder.error(e, node); 86 } 87 } 88 } 89 | Popular Tags |