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.config.TypeStrategy; 35 import com.caucho.util.L10N; 36 37 import org.w3c.dom.Node ; 38 39 42 public class BooleanType extends TypeStrategy { 43 protected static final L10N L = new L10N(BooleanType.class); 44 45 public static final BooleanType TYPE = new BooleanType(); 46 47 private BooleanType() 48 { 49 } 50 51 54 public String getTypeName() 55 { 56 return getClass().getName(); 57 } 58 59 66 public Object configure(NodeBuilder builder, Node node, Object parent) 67 throws ConfigException 68 { 69 String textValue = node.getTextContent().trim(); 70 71 if (textValue.indexOf("${") >= 0) 72 return builder.evalBoolean(textValue) ? Boolean.TRUE : Boolean.FALSE; 73 else if (textValue.equals("true") || textValue.equals("1")) 74 return Boolean.TRUE; 75 else 76 return Boolean.FALSE; 77 } 78 } 79 | Popular Tags |