本文整理汇总了Java中org.msgpack.value.ValueFactory.newFloat方法的典型用法代码示例。如果您正苦于以下问题:Java ValueFactory.newFloat方法的具体用法?Java ValueFactory.newFloat怎么用?Java ValueFactory.newFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.msgpack.value.ValueFactory
的用法示例。
在下文中一共展示了ValueFactory.newFloat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromBoolean
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
public Value fromBoolean(Type outputType, BooleanValue value)
{
if (outputType instanceof BooleanType) {
return value;
}
else if (outputType instanceof LongType) {
return ValueFactory.newInteger(BooleanCast.asLong(value.getBoolean()));
}
else if (outputType instanceof DoubleType) {
return ValueFactory.newFloat(BooleanCast.asDouble(value.getBoolean()));
}
else if (outputType instanceof StringType) {
return ValueFactory.newString(BooleanCast.asString(value.getBoolean()));
}
else if (outputType instanceof JsonType) {
return BooleanCast.asJson(value.getBoolean());
}
else {
assert (false);
return null;
}
}
示例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: decimalFromLong
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
protected Value decimalFromLong(long value)
{
// TODO: support string conversion
return ValueFactory.newFloat(new BigDecimal(value, mc).movePointLeft(scale).doubleValue());
}
示例5: doubleColumn
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public void doubleColumn(Column column) {
Value columnName = ValueFactory.newString(column.getName());
Value value = ValueFactory.newFloat(reader.getDouble(column));
builder.put(columnName, value);
}
示例6: visitNumberValue
import org.msgpack.value.ValueFactory; //导入方法依赖的package包/类
@Override
public Value visitNumberValue(JSONParser.NumberValueContext ctx)
{
Double num = Double.parseDouble(ctx.getText());
return ValueFactory.newFloat(num);
}