KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > dynamic > BooleanXPathBasedConfigItem


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema.dynamic;
5
6 import org.apache.xmlbeans.XmlObject;
7
8 import com.tc.config.schema.context.ConfigContext;
9
10 /**
11  * An {@link XPathBasedConfigItem} that returns a Java <code>boolean</code> value.
12  */

13 public class BooleanXPathBasedConfigItem extends XPathBasedConfigItem implements BooleanConfigItem {
14
15   public BooleanXPathBasedConfigItem(ConfigContext context, String JavaDoc xpath, boolean defaultValue) {
16     super(context, xpath, new Boolean JavaDoc(defaultValue));
17   }
18
19   public BooleanXPathBasedConfigItem(ConfigContext context, String JavaDoc xpath) {
20     super(context, xpath);
21   }
22
23   protected Object JavaDoc fetchDataFromXmlObject(XmlObject xmlObject) {
24     return super.fetchDataFromXmlObjectByReflection(xmlObject, "getBooleanValue");
25   }
26
27   public boolean getBoolean() {
28     return ((Boolean JavaDoc) getObject()).booleanValue();
29   }
30
31 }
32
Popular Tags