1 29 30 package com.caucho.config.jaxb; 31 32 import com.caucho.config.AttributeStrategy; 33 import com.caucho.config.ConfigException; 34 import com.caucho.config.NodeBuilder; 35 import com.caucho.el.Expr; 36 import com.caucho.xml.QName; 37 38 import org.w3c.dom.Node ; 39 40 public class JaxbProperty extends AttributeStrategy { 41 49 public void configure(NodeBuilder builder, 50 Object bean, 51 QName name, 52 Node node) 53 throws ConfigException 54 { 55 configureElement(builder, bean, name, node); 56 } 57 58 66 public void configureAttribute(NodeBuilder builder, 67 Object bean, 68 QName name, 69 String value) 70 throws ConfigException 71 { 72 } 73 74 82 public void configureElement(NodeBuilder builder, 83 Object bean, 84 QName name, 85 Node value) 86 throws ConfigException 87 { 88 } 89 90 protected static boolean evalBoolean(NodeBuilder builder, String textValue) 91 { 92 if (textValue.indexOf("${") >= 0) 93 return builder.evalBoolean(textValue); 94 else if (textValue.equals("true") || textValue.equals("1")) 95 return true; 96 else 97 return false; 98 } 99 100 protected static long evalLong(NodeBuilder builder, String textValue) 101 { 102 if (textValue.indexOf("${") >= 0) 103 return builder.evalLong(textValue); 104 else 105 return Expr.toLong(textValue, null); 106 } 107 } 108 | Popular Tags |