本文整理汇总了Java中org.msgpack.value.ValueFactory.newBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java ValueFactory.newBoolean方法的具体用法?Java ValueFactory.newBoolean怎么用?Java ValueFactory.newBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.msgpack.value.ValueFactory
的用法示例。
在下文中一共展示了ValueFactory.newBoolean方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromDouble
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
public Value fromDouble(Type outputType, FloatValue value)
{
if (outputType instanceof BooleanType) {
return ValueFactory.newBoolean(DoubleCast.asBoolean(value.toDouble()));
}
else if (outputType instanceof LongType) {
return ValueFactory.newInteger(DoubleCast.asLong(value.toDouble()));
}
else if (outputType instanceof DoubleType) {
return value;
}
else if (outputType instanceof StringType) {
return ValueFactory.newString(DoubleCast.asString(value.toDouble()));
}
else if (outputType instanceof JsonType) {
return DoubleCast.asJson(value.toDouble());
}
else {
assert (false);
return null;
}
}
示例2: visitReferenceValue
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public Value visitReferenceValue(JSONParser.ReferenceValueContext ctx)
{
JSONParser.ReferenceContext ref = ctx.reference();
String key = ref.ID().getText();
Column column = inputSchema.lookupColumn(key);
Value value;
Type column_type = column.getType();
if (pageReader.isNull(column)){
value = ValueFactory.newNil();
}
else if (column_type == Types.BOOLEAN) {
value = ValueFactory.newBoolean(pageReader.getBoolean(column));
}
else if (column_type == Types.DOUBLE) {
value = ValueFactory.newFloat(pageReader.getDouble(column));
}
else if (column_type == Types.STRING) {
value = ValueFactory.newString(pageReader.getString(column));
}
else if (column_type == Types.LONG) {
value = ValueFactory.newInteger(pageReader.getLong(column));
}
else if (column_type == Types.JSON) {
value = pageReader.getJson(column);
}
else {
// Unsupported type;
value = ValueFactory.newNil();
}
return value;
}
示例3: getDefault
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
static Value getDefault(PluginTask task, String name, Type type, ColumnConfig columnConfig)
{
Object defaultValue = ColumnVisitorImpl.getDefault(task, name, type, columnConfig);
if (defaultValue == null) {
return ValueFactory.newNil();
}
if (type instanceof BooleanType) {
return ValueFactory.newBoolean((Boolean) defaultValue);
}
else if (type instanceof LongType) {
return ValueFactory.newInteger((Long) defaultValue);
}
else if (type instanceof DoubleType) {
return ValueFactory.newFloat((Double) defaultValue);
}
else if (type instanceof StringType) {
return ValueFactory.newString((String) defaultValue.toString());
}
else if (type instanceof JsonType) {
return (Value) defaultValue;
}
else if (type instanceof TimestampType) {
throw new ConfigException("type: timestamp is not available in json path");
}
else {
throw new ConfigException(String.format("type: '%s' is not supported", type));
}
}
示例4: booleanColumn
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public void booleanColumn(Column column) {
Value columnName = ValueFactory.newString(column.getName());
Value value = ValueFactory.newBoolean(reader.getBoolean(column));
builder.put(columnName, value);
}
示例5: visitTrueValue
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public Value visitTrueValue(JSONParser.TrueValueContext ctx)
{
return ValueFactory.newBoolean(true);
}
示例6: visitFalseValue
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public Value visitFalseValue(JSONParser.FalseValueContext ctx)
{
return ValueFactory.newBoolean(false);
}