01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.config.schema.dynamic;
05:
06: import org.apache.xmlbeans.XmlObject;
07:
08: import com.tc.config.schema.context.ConfigContext;
09:
10: /**
11: * An {@link XPathBasedConfigItem} that returns a {@link String}.
12: */
13: public class StringXPathBasedConfigItem extends XPathBasedConfigItem
14: implements StringConfigItem {
15:
16: public StringXPathBasedConfigItem(ConfigContext context,
17: String xpath) {
18: super (context, xpath);
19: }
20:
21: protected Object fetchDataFromXmlObject(XmlObject xmlObject) {
22: return super .fetchDataFromXmlObjectByReflection(xmlObject,
23: "getStringValue");
24: }
25:
26: protected Object fetchDataFromDefaultValue(String defaultValue) {
27: return defaultValue;
28: }
29:
30: public String getString() {
31: return (String) getObject();
32: }
33:
34: }
|