KickJava   Java API By Example, From Geeks To Geeks.

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


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 {@link String}.
12  */

13 public class StringXPathBasedConfigItem extends XPathBasedConfigItem implements StringConfigItem {
14
15   public StringXPathBasedConfigItem(ConfigContext context, String JavaDoc xpath) {
16     super(context, xpath);
17   }
18
19   protected Object JavaDoc fetchDataFromXmlObject(XmlObject xmlObject) {
20     return super.fetchDataFromXmlObjectByReflection(xmlObject, "getStringValue");
21   }
22
23   protected Object JavaDoc fetchDataFromDefaultValue(String JavaDoc defaultValue) {
24     return defaultValue;
25   }
26
27   public String JavaDoc getString() {
28     return (String JavaDoc) getObject();
29   }
30
31 }
32
Popular Tags