本文整理汇总了Java中org.javarosa.core.model.data.BooleanData类的典型用法代码示例。如果您正苦于以下问题:Java BooleanData类的具体用法?Java BooleanData怎么用?Java BooleanData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BooleanData类属于org.javarosa.core.model.data包,在下文中一共展示了BooleanData类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: classForDataType
import org.javarosa.core.model.data.BooleanData; //导入依赖的package包/类
/**
* map xforms data types to the Class that represents that data in a FormInstance
* @param dataType
* @return
*/
public static Class classForDataType (int dataType) {
switch (dataType) {
case Constants.DATATYPE_NULL: return StringData.class;
case Constants.DATATYPE_TEXT: return StringData.class;
case Constants.DATATYPE_INTEGER: return IntegerData.class;
case Constants.DATATYPE_LONG: return LongData.class;
case Constants.DATATYPE_DECIMAL: return DecimalData.class;
case Constants.DATATYPE_BOOLEAN: return BooleanData.class;
case Constants.DATATYPE_DATE: return DateData.class;
case Constants.DATATYPE_TIME: return TimeData.class;
case Constants.DATATYPE_DATE_TIME: return DateTimeData.class;
case Constants.DATATYPE_CHOICE: return SelectOneData.class;
case Constants.DATATYPE_CHOICE_LIST: return SelectMultiData.class;
case Constants.DATATYPE_GEOPOINT: return GeoPointData.class;
case Constants.DATATYPE_GEOSHAPE: return GeoShapeData.class;
case Constants.DATATYPE_GEOTRACE: return GeoTraceData.class;
default: return null;
}
}
示例2: unpackValue
import org.javarosa.core.model.data.BooleanData; //导入依赖的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?
}
}
示例3: serializeAnswerData
import org.javarosa.core.model.data.BooleanData; //导入依赖的package包/类
public Object serializeAnswerData(BooleanData data) {
if(((Boolean)data.getValue()).booleanValue()) {
return "1";
} else {
return "0";
}
}
示例4: unpackValue
import org.javarosa.core.model.data.BooleanData; //导入依赖的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 DateTimeData) {
return val.getValue();
} else if (val instanceof BooleanData) {
return val.getValue();
} else if (val instanceof GeoPointData) {
return val.uncast().getString();
} else {
System.out.println("warning: unrecognized data type in xpath expr: " + val.getClass().getName());
//TODO: Does this mess up any of our other plans?
return val.uncast().getString();
}
}
示例5: serializeAnswerData
import org.javarosa.core.model.data.BooleanData; //导入依赖的package包/类
public Object serializeAnswerData(BooleanData data) {
if (((Boolean)data.getValue()).booleanValue()) {
return "1";
} else {
return "0";
}
}
示例6: unpackValue
import org.javarosa.core.model.data.BooleanData; //导入依赖的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 ((Integer)val.getValue()).doubleValue();
} else if (val instanceof LongData) {
return ((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 DateTimeData) {
return val.getValue();
} else if (val instanceof BooleanData) {
return val.getValue();
} else if (val instanceof GeoPointData) {
return val.uncast().getString();
} else {
System.out.println("warning: unrecognized data type in xpath expr: " + val.getClass().getName());
//TODO: Does this mess up any of our other plans?
return val.uncast().getString();
}
}
示例7: serializeAnswerData
import org.javarosa.core.model.data.BooleanData; //导入依赖的package包/类
public Object serializeAnswerData(BooleanData data) {
if ((Boolean)data.getValue()) {
return "1";
} else {
return "0";
}
}