当前位置: 首页>>代码示例>>Java>>正文


Java ValueFactory.newInteger方法代码示例

本文整理汇总了Java中org.msgpack.value.ValueFactory.newInteger方法的典型用法代码示例。如果您正苦于以下问题:Java ValueFactory.newInteger方法的具体用法?Java ValueFactory.newInteger怎么用?Java ValueFactory.newInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.msgpack.value.ValueFactory的用法示例。


在下文中一共展示了ValueFactory.newInteger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromBoolean

import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
public Value fromBoolean(Type outputType, BooleanValue value)
{
    if (outputType instanceof BooleanType) {
        return value;
    }
    else if (outputType instanceof LongType) {
        return ValueFactory.newInteger(BooleanCast.asLong(value.getBoolean()));
    }
    else if (outputType instanceof DoubleType) {
        return ValueFactory.newFloat(BooleanCast.asDouble(value.getBoolean()));
    }
    else if (outputType instanceof StringType) {
        return ValueFactory.newString(BooleanCast.asString(value.getBoolean()));
    }
    else if (outputType instanceof JsonType) {
        return BooleanCast.asJson(value.getBoolean());
    }
    else {
        assert (false);
        return null;
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:23,代码来源:JsonCaster.java

示例2: 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;
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-typecast,代码行数:23,代码来源:JsonCaster.java

示例3: 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;
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-filter-build_json,代码行数:35,代码来源:BuildJsonParseTreeVisitor.java

示例4: 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));
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-column,代码行数:29,代码来源:JsonVisitor.java

示例5: longColumn

import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public void longColumn(Column column) {
    Value columnName = ValueFactory.newString(column.getName());
    Value value = ValueFactory.newInteger(reader.getLong(column));
    builder.put(columnName, value);
}
 
开发者ID:tomykaira,项目名称:embulk-output-s3_per_record,代码行数:7,代码来源:MessagePackMultiColumnVisitor.java


注:本文中的org.msgpack.value.ValueFactory.newInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。