Java Code Examples for org.msgpack.value.Value#isIntegerValue()
The following examples show how to use
org.msgpack.value.Value#isIntegerValue() .
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: ColumnCaster.java From embulk-parser-jsonl with MIT License | 6 votes |
public static boolean asBoolean(Value value) throws DataException { if (value.isBooleanValue()) { return value.asBooleanValue().getBoolean(); } else if (value.isIntegerValue()) { return LongCast.asBoolean(value.asIntegerValue().asLong()); } else if (value.isFloatValue()) { return DoubleCast.asBoolean(value.asFloatValue().toDouble()); } else if (value.isStringValue()) { return StringCast.asBoolean(value.asStringValue().asString()); } else { return JsonCast.asBoolean(value); } }
Example 2
Source File: ColumnCaster.java From embulk-parser-jsonl with MIT License | 6 votes |
public static long asLong(Value value) throws DataException { if (value.isBooleanValue()) { return BooleanCast.asLong(value.asBooleanValue().getBoolean()); } else if (value.isIntegerValue()) { return value.asIntegerValue().asLong(); } else if (value.isFloatValue()) { return DoubleCast.asLong(value.asFloatValue().toDouble()); } else if (value.isStringValue()) { return StringCast.asLong(value.asStringValue().asString()); } else { return JsonCast.asLong(value); } }
Example 3
Source File: ColumnCaster.java From embulk-parser-jsonl with MIT License | 6 votes |
public static double asDouble(Value value) throws DataException { if (value.isBooleanValue()) { return BooleanCast.asDouble(value.asBooleanValue().getBoolean()); } else if (value.isIntegerValue()) { return LongCast.asDouble(value.asIntegerValue().asLong()); } else if (value.isFloatValue()) { return value.asFloatValue().toDouble(); } else if (value.isStringValue()) { return StringCast.asDouble(value.asStringValue().asString()); } else { return JsonCast.asDouble(value); } }
Example 4
Source File: ColumnCaster.java From embulk-parser-jsonl with MIT License | 6 votes |
public static Timestamp asTimestamp(Value value, TimestampParser parser) throws DataException { if (value.isBooleanValue()) { return BooleanCast.asTimestamp(value.asBooleanValue().getBoolean()); } else if (value.isIntegerValue()) { return LongCast.asTimestamp(value.asIntegerValue().asLong()); } else if (value.isFloatValue()) { return DoubleCast.asTimestamp(value.asFloatValue().toDouble()); } else if (value.isStringValue()) { return StringCast.asTimestamp(value.asStringValue().asString(), parser); } else { return JsonCast.asTimestamp(value); } }