Java Code Examples for org.msgpack.value.Value#isNilValue()
The following examples show how to use
org.msgpack.value.Value#isNilValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TdOperatorFactory.java From digdag with Apache License 2.0 | 5 votes |
private static void addCsvValue(Writer out, Value value) throws IOException { if (value.isStringValue()) { addCsvText(out, value.asStringValue().asString()); } else if (value.isNilValue()) { // write nothing } else { addCsvText(out, value.toJson()); } }
Example 2
Source File: ColumnVisitorImpl.java From embulk-parser-jsonl with MIT License | 4 votes |
protected boolean isNil(Value v) { return v == null || v.isNilValue(); }
Example 3
Source File: MessagePackDeserializer.java From attic-polygene-java with Apache License 2.0 | 4 votes |
@SuppressWarnings( "unchecked" ) private <T> T doDeserialize( ModuleDescriptor module, ValueType valueType, Value value ) { try { if( value == null || value.isNilValue() ) { return null; } Converter<Object> converter = converters.converterFor( valueType ); if( converter != null ) { return (T) converter.fromString( doDeserialize( module, ValueType.STRING, value ).toString() ); } MessagePackAdapter<?> adapter = adapters.adapterFor( valueType ); if( adapter != null ) { return (T) adapter.deserialize( value, ( val, type ) -> doDeserialize( module, valueType, val ) ); } Class<? extends ValueType> valueTypeClass = valueType.getClass(); if( EnumType.class.isAssignableFrom( valueTypeClass ) ) { return (T) Enum.valueOf( (Class) valueType.primaryType(), value.asStringValue().asString() ); } if( ArrayType.class.isAssignableFrom( valueTypeClass ) ) { return (T) deserializeArray( module, (ArrayType) valueType, value ); } if( CollectionType.class.isAssignableFrom( valueTypeClass ) ) { return (T) deserializeCollection( module, (CollectionType) valueType, value.asArrayValue() ); } if( MapType.class.isAssignableFrom( valueTypeClass ) ) { return (T) deserializeMap( module, (MapType) valueType, value.asMapValue() ); } if( StatefulAssociationValueType.class.isAssignableFrom( valueTypeClass ) ) { return (T) deserializeStatefulAssociationValue( module, (StatefulAssociationValueType<?>) valueType, value.asMapValue() ); } return (T) doGuessDeserialize( module, valueType, value ); } catch( IOException | ClassNotFoundException ex ) { throw new SerializationException( "Unable to deserialize " + valueType + " from: " + value ); } }