本文整理汇总了Java中org.javarosa.core.model.data.IAnswerData.getDisplayText方法的典型用法代码示例。如果您正苦于以下问题:Java IAnswerData.getDisplayText方法的具体用法?Java IAnswerData.getDisplayText怎么用?Java IAnswerData.getDisplayText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.model.data.IAnswerData
的用法示例。
在下文中一共展示了IAnswerData.getDisplayText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unpackValue
import org.javarosa.core.model.data.IAnswerData; //导入方法依赖的package包/类
public static Object unpackValue (IAnswerData val) {
if (val == null) {
return "";
} else if (val instanceof UncastData) {
return val.getValue();
} else if (val instanceof IntegerData) {
return new Double(((Integer)val.getValue()).doubleValue());
} else if (val instanceof LongData) {
return new Double(((Long)val.getValue()).doubleValue());
} else if (val instanceof DecimalData) {
return val.getValue();
} else if (val instanceof StringData) {
return val.getValue();
} else if (val instanceof SelectOneData) {
return ((Selection)val.getValue()).getValue();
} else if (val instanceof SelectMultiData) {
return (new XFormAnswerDataSerializer()).serializeAnswerData(val);
} else if (val instanceof DateData) {
return val.getValue();
} else if (val instanceof BooleanData) {
return val.getValue();
} else if (val instanceof GeoPointData) {
// we have no access fns that interact with double[4] arrays (the getValue() data type)...
return val.getDisplayText();
} else if (val instanceof GeoShapeData) {
// we have no access fns that interact with GeoShape objects (the getValue() data type)...
return val.getDisplayText();
} else if (val instanceof GeoTraceData) {
// we have no access fns that interact with GeoTrace objects (the getValue() data type)...
return val.getDisplayText();
} else {
System.out.println("warning: unrecognized data type in xpath expr: " + val.getClass().getName());
return val.getValue(); //is this a good idea?
}
}
示例2: saveProperty
import org.javarosa.core.model.data.IAnswerData; //导入方法依赖的package包/类
private void saveProperty (String propName, TreeElement node) {
IAnswerData answer = node.getValue();
String value = (answer == null ? null : answer.getDisplayText());
if (propName != null && propName.length() > 0 && value != null && value.length() > 0)
PropertyManager._().setProperty(propName, value);
}