本文整理了Java中org.msgpack.value.Value.asBooleanValue()
方法的一些代码示例,展示了Value.asBooleanValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.asBooleanValue()
方法的具体详情如下:
包路径:org.msgpack.value.Value
类名称:Value
方法名:asBooleanValue
[英]Returns the value as BooleanValue. Otherwise throws MessageTypeCastException. Note that you can't use instanceof
or cast ((BooleanValue) thisValue)
to check type of a value because type of a mutable value is variable.
[中]将值作为布尔值返回。否则抛出MessageTypeCastException。请注意,不能使用instanceof
或强制转换((BooleanValue) thisValue)
来检查值的类型,因为可变值的类型是可变的。
代码示例来源:origin: apache/attic-polygene-java
@Override
public Boolean deserialize( Value value, BiFunction<Value, ValueType, Object> deserialize )
{
return value.asBooleanValue().getBoolean();
}
}
代码示例来源:origin: org.msgpack/msgpack-core
@Override
public boolean equals(Object o)
{
if (o == this) {
return true;
}
if (!(o instanceof Value)) {
return false;
}
Value v = (Value) o;
if (!v.isBooleanValue()) {
return false;
}
return value == v.asBooleanValue().getBoolean();
}
代码示例来源:origin: io.digdag/digdag-standards
private boolean isTruthy(Value firstCol)
{
// Anything that is not NULL and not FALSE or 0 is considered truthy.
switch (firstCol.getValueType()) {
case NIL:
return false;
case BOOLEAN:
return firstCol.asBooleanValue().getBoolean();
case INTEGER:
return firstCol.asIntegerValue().asLong() != 0;
default:
return true;
}
}
}
代码示例来源:origin: io.digdag/digdag-standards
private Object value(Value value)
{
switch (value.getValueType()) {
case NIL:
return null;
case BOOLEAN:
return value.asBooleanValue().getBoolean();
case INTEGER:
return value.asIntegerValue().toLong();
case FLOAT:
return value.asFloatValue().toFloat();
case STRING:
return value.asStringValue().toString();
case BINARY:
case ARRAY:
case MAP:
case EXTENSION:
default:
throw new UnsupportedOperationException("Unsupported column type: " + value.getValueType());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!