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


Java ValueFactory.newNil方法代码示例

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


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

示例1: InternalMap

import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
public InternalMap(List<String> keys)
{
    this.numFields = keys.size();
    this.kvs = new Value[numFields * 2];
    int i = 0;
    for (String key : keys) {
        kvs[i++] = ValueFactory.newString(key);
        kvs[i++] = ValueFactory.newNil();
    }
}
 
开发者ID:CyberAgent,项目名称:embulk-input-parquet_hadoop,代码行数:11,代码来源:ParquetValueConverter.java

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

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

示例4: JsonColumn

import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
public JsonColumn(String path, Type type, Value defaultValue, String src)
{
    Path compiledPath = PathCompiler.compile(path);
    Path compiledSrc = src == null ? compiledPath : PathCompiler.compile(src);
    RootPathToken compiledRoot = (RootPathToken) compiledPath.getRoot();
    RootPathToken compiledSrcRoot = (RootPathToken) compiledSrc.getRoot();
    this.path = compiledPath.toString();
    this.type = type;
    this.defaultValue = (defaultValue == null ? ValueFactory.newNil() : defaultValue);
    this.src = compiledSrc.toString();

    this.pathValue = ValueFactory.newString(path);
    this.parentPath = compiledPath.getParentPath();

    this.tailIndex = getTailIndex(compiledRoot);
    this.parentPathValue = ValueFactory.newString(parentPath);
    String tailName = getTailName(compiledRoot);
    this.tailNameValue = tailName == null ? ValueFactory.newNil() : ValueFactory.newString(tailName);

    this.srcValue = ValueFactory.newString(this.src);
    this.srcParentPath = compiledSrc.getParentPath();
    this.srcTailIndex = getTailIndex(compiledSrcRoot);
    this.srcParentPathValue = ValueFactory.newString(this.srcParentPath);
    String srcTailName = getTailName(compiledSrcRoot);
    this.srcTailNameValue = srcTailName == null ? ValueFactory.newNil() : ValueFactory.newString(srcTailName);

    if (!srcParentPath.equals(parentPath)) {
        throw new ConfigException(String.format("The branch (parent path) of src \"%s\" must be same with of name \"%s\" yet", src, path));
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-column,代码行数:31,代码来源:JsonColumn.java

示例5: start

import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public void start()
{
    currentElement = ValueFactory.newNil();
}
 
开发者ID:CyberAgent,项目名称:embulk-input-parquet_hadoop,代码行数:6,代码来源:ParquetValueConverter.java

示例6: visitNullValue

import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public Value visitNullValue(JSONParser.NullValueContext ctx)
{
    return ValueFactory.newNil();
}
 
开发者ID:hiroyuki-sato,项目名称:embulk-filter-build_json,代码行数:6,代码来源:BuildJsonParseTreeVisitor.java

示例7: doSerialize

import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
private Value doSerialize( Options options, Object object, boolean root )
{
    try
    {
        if( object == null )
        {
            return ValueFactory.newNil();
        }
        Class<?> objectClass = object.getClass();
        Converter<Object> converter = converters.converterFor( objectClass );
        if( converter != null )
        {
            return doSerialize( options, converter.toString( object ), false );
        }
        MessagePackAdapter<?> adapter = adapters.adapterFor( objectClass );
        if( adapter != null )
        {
            return adapter.serialize( object, obj -> doSerialize( options, obj, false ) );
        }
        if( EnumType.isEnum( objectClass ) )
        {
            return ValueFactory.newString( object.toString() );
        }
        if( StatefulAssociationValueType.isStatefulAssociationValue( objectClass ) )
        {
            return serializeStatefulAssociationValue( options, object, root );
        }
        if( MapType.isMap( objectClass ) )
        {
            return serializeMap( options, (Map<?, ?>) object );
        }
        if( ArrayType.isArray( objectClass ) )
        {
            return serializeArray( options, object );
        }
        if( Iterable.class.isAssignableFrom( objectClass ) )
        {
            return serializeIterable( options, (Iterable<?>) object );
        }
        if( Stream.class.isAssignableFrom( objectClass ) )
        {
            return serializeStream( options, (Stream<?>) object );
        }
        throw new SerializationException( "Don't know how to serialize " + object );
    }
    catch( IOException ex )
    {
        throw new SerializationException( "Unable to serialize " + object, ex );
    }
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:51,代码来源:MessagePackSerializer.java


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