本文整理汇总了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();
}
}
示例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: 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));
}
}
示例5: start
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public void start()
{
currentElement = ValueFactory.newNil();
}
示例6: visitNullValue
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public Value visitNullValue(JSONParser.NullValueContext ctx)
{
return ValueFactory.newNil();
}
示例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 );
}
}