本文整理汇总了Java中com.fasterxml.jackson.databind.node.FloatNode类的典型用法代码示例。如果您正苦于以下问题:Java FloatNode类的具体用法?Java FloatNode怎么用?Java FloatNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FloatNode类属于com.fasterxml.jackson.databind.node包,在下文中一共展示了FloatNode类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: toValueNode
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
@Deprecated
public static ValueNode toValueNode(Object value) {
if (value == null)
return NullNode.instance;
if (value instanceof ValueNode)
return (ValueNode) value;
if (value instanceof Boolean)
return BooleanNode.valueOf((boolean) value);
else if (value instanceof Integer)
return IntNode.valueOf((int) value);
else if (value instanceof Long)
return LongNode.valueOf((long) value);
else if (value instanceof Double)
return DoubleNode.valueOf((double) value);
else if (value instanceof Float)
return FloatNode.valueOf((float) value);
return TextNode.valueOf(value.toString());
}
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:21,代码来源:Json8.java
示例2: toValueNode
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
public static ValueNode toValueNode(Object value) {
if (value == null)
return NullNode.instance;
if (value instanceof ValueNode)
return (ValueNode) value;
if (value instanceof Boolean)
return BooleanNode.valueOf((boolean) value);
else if (value instanceof Integer)
return IntNode.valueOf((int) value);
else if (value instanceof Long)
return LongNode.valueOf((long) value);
else if (value instanceof Double)
return DoubleNode.valueOf((double) value);
else if (value instanceof Float)
return FloatNode.valueOf((float) value);
return TextNode.valueOf(value.toString());
}
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:20,代码来源:Json7.java
示例3: createNode
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
private JsonNode createNode(Object value) {
if (value instanceof Float) {
return new FloatNode((Float) value);
} else if (value instanceof Double) {
return new DoubleNode((Double) value);
}
return null;
}
开发者ID:Mercateo,项目名称:rest-schemagen,代码行数:9,代码来源:NumberJsonPropertyMapper.java
示例4: safeEncodeValue
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
/**
* Safely serialize a value.
*
* @since 1.11.2
* @param encoder The <code>StenoEncoder</code> instance.
* @param value The <code>Object</code> instance to safely serialize.
*/
public static void safeEncodeValue(final StringBuilder encoder, @Nullable final Object value) {
if (value == null) {
encoder.append("null");
} else if (value instanceof Map) {
safeEncodeMap(encoder, (Map<?, ?>) value);
} else if (value instanceof List) {
safeEncodeList(encoder, (List<?>) value);
} else if (value.getClass().isArray()) {
safeEncodeArray(encoder, value);
} else if (value instanceof LogValueMapFactory.LogValueMap) {
safeEncodeLogValueMap(encoder, (LogValueMapFactory.LogValueMap) value);
} else if (value instanceof Throwable) {
safeEncodeThrowable(encoder, (Throwable) value);
} else if (StenoSerializationHelper.isSimpleType(value)) {
if (value instanceof Boolean) {
encoder.append(BooleanNode.valueOf((Boolean) value).toString());
} else if (value instanceof Double) {
encoder.append(DoubleNode.valueOf((Double) value).toString());
} else if (value instanceof Float) {
encoder.append(FloatNode.valueOf((Float) value).toString());
} else if (value instanceof Long) {
encoder.append(LongNode.valueOf((Long) value).toString());
} else if (value instanceof Integer) {
encoder.append(IntNode.valueOf((Integer) value).toString());
} else {
encoder.append(new TextNode(value.toString()).toString());
}
} else {
safeEncodeValue(encoder, LogReferenceOnly.of(value).toLogValue());
}
}
开发者ID:ArpNetworking,项目名称:logback-steno,代码行数:39,代码来源:SafeSerializationHelper.java
示例5: unwrap
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
public static Object unwrap(Object val) { // Can Jackson do this via
// ObjectMapper.treeToValue()? The
// spec is unclear
Object result = val;
ObjectMapper mapper = new ObjectMapper();
if (val instanceof ObjectNode) {
result = mapper.convertValue((ObjectNode) val, Map.class);
} else if (val instanceof ArrayNode) {
result = mapper.convertValue((ObjectNode) val, List.class);
} else if (val instanceof NullNode) {
result = null;
} else if (val instanceof BooleanNode) {
result = ((BooleanNode) val).booleanValue();
} else if (val instanceof ShortNode) {
result = ((ShortNode) val).shortValue();
} else if (val instanceof IntNode) {
result = ((IntNode) val).intValue();
} else if (val instanceof LongNode) {
result = ((LongNode) val).longValue();
} else if (val instanceof DoubleNode) {
result = ((DoubleNode) val).doubleValue();
} else if (val instanceof FloatNode) {
result = ((FloatNode) val).floatValue();
} else if (val instanceof BigIntegerNode) {
result = ((BigIntegerNode) val).bigIntegerValue();
} else if (val instanceof DecimalNode) {
result = ((DecimalNode) val).decimalValue();
}
return result;
}
开发者ID:sassoftware,项目名称:unravl,代码行数:31,代码来源:Json.java
示例6: decodeFloat
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
private FloatNode decodeFloat() {
return new FloatNode(this.threadBuffer.get().getFloat());
}
开发者ID:mervin0502,项目名称:Lizard,代码行数:4,代码来源:Decoder.java
示例7: generateValue
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
private JsonNode generateValue(LinkedList<String> path, ObjectNode schema, int index) {
String stringPath = Utils.join(".", path.toArray(new String[path.size()]));
List<Object> list = paths.get(stringPath);
if (list != null)
return Json7.toNode(list.get(random.nextInt(list.size())));
JsonNode values = Json7.get(schema, "_values");
if (values != null) {
if (values.isArray()) {
if (index < values.size())
return values.get(index);
return values.get(random.nextInt(values.size()));
} else
return values;
}
JsonNode enumType = Json7.get(schema, "_enumType");
if (enumType != null) {
if (types.containsKey(enumType.asText())) {
List<String> typeValues = types.get(enumType.asText());
String value = typeValues.get(random.nextInt(typeValues.size()));
return Json7.toNode(value);
}
}
JsonNode examples = Json7.get(schema, "_examples");
if (examples != null) {
if (examples.isArray()) {
if (index < examples.size())
return examples.get(index);
return examples.get(random.nextInt(examples.size()));
} else
return examples;
}
String type = schema.get("_type").asText();
if ("text".equals(type))
return TextNode.valueOf(
"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness.");
else if ("string".equals(type))
return TextNode.valueOf("RD5654GH78");
else if ("boolean".equals(type))
return BooleanNode.valueOf(random.nextBoolean());
else if ("integer".equals(type))
return IntNode.valueOf(random.nextInt());
else if ("long".equals(type))
return LongNode.valueOf(random.nextLong());
else if ("float".equals(type))
return FloatNode.valueOf(random.nextFloat());
else if ("double".equals(type))
return DoubleNode.valueOf(random.nextDouble());
else if ("date".equals(type))
return TextNode.valueOf("2015-09-09");
else if ("time".equals(type))
return TextNode.valueOf("15:30:00");
else if ("timestamp".equals(type))
return TextNode.valueOf("2015-01-09T15:37:00.123Z");
else if ("enum".equals(type))
return TextNode.valueOf("blue");
else if ("geopoint".equals(type))
return Json7.object("lat", 48 + random.nextDouble(), "lon", 2 + random.nextDouble());
else if ("object".equals(type))
return generateObject(path, schema, index);
return NullNode.getInstance();
}
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:69,代码来源:JsonGenerator.java
示例8: gt
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
public static GtExpression gt(String property, Float value) {
return new GtExpression(val(property), FloatNode.valueOf(value));
}
开发者ID:kcthota,项目名称:JSONQuery,代码行数:4,代码来源:Expr.java
示例9: lt
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
public static LtExpression lt(String property, Float value) {
return new LtExpression(val(property), FloatNode.valueOf(value));
}
开发者ID:kcthota,项目名称:JSONQuery,代码行数:4,代码来源:Expr.java
示例10: ge
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
public static GeExpression ge(String property, Float value) {
return new GeExpression(val(property), FloatNode.valueOf(value));
}
开发者ID:kcthota,项目名称:JSONQuery,代码行数:4,代码来源:Expr.java
示例11: le
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
public static LeExpression le(String property, Float value) {
return new LeExpression(val(property), FloatNode.valueOf(value));
}
开发者ID:kcthota,项目名称:JSONQuery,代码行数:4,代码来源:Expr.java
示例12: convert
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
private Float convert(Float value) {
return (Float) FloatConverter.converter().value(new FloatNode(value));
}
开发者ID:nhl,项目名称:link-rest,代码行数:4,代码来源:FloatConverterTest.java
示例13: testTypeDecoding
import com.fasterxml.jackson.databind.node.FloatNode; //导入依赖的package包/类
private static <T> void testTypeDecoding(Decoder.Type type, Map<T, byte[]> tests)
throws IOException {
NodeCache cache = new CHMCache();
for (Map.Entry<T, byte[]> entry : tests.entrySet()) {
T expect = entry.getKey();
byte[] input = entry.getValue();
String desc = "decoded " + type.name() + " - " + expect;
FileChannel fc = DecoderTest.getFileChannel(input);
MappedByteBuffer mmap = fc.map(MapMode.READ_ONLY, 0, fc.size());
try {
Decoder decoder = new Decoder(cache, mmap, 0);
decoder.POINTER_TEST_HACK = true;
// XXX - this could be streamlined
if (type.equals(Decoder.Type.BYTES)) {
assertArrayEquals(desc, (byte[]) expect, decoder.decode(0).binaryValue());
} else if (type.equals(Decoder.Type.ARRAY)) {
assertEquals(desc, expect, decoder.decode(0));
} else if (type.equals(Decoder.Type.UINT16)
|| type.equals(Decoder.Type.INT32)) {
assertEquals(desc, expect, decoder.decode(0).asInt());
} else if (type.equals(Decoder.Type.UINT32)
|| type.equals(Decoder.Type.POINTER)) {
assertEquals(desc, expect, decoder.decode(0).asLong());
} else if (type.equals(Decoder.Type.UINT64)
|| type.equals(Decoder.Type.UINT128)) {
assertEquals(desc, expect, decoder.decode(0).bigIntegerValue());
} else if (type.equals(Decoder.Type.DOUBLE)) {
assertEquals(desc, expect, decoder.decode(0).asDouble());
} else if (type.equals(Decoder.Type.FLOAT)) {
assertEquals(desc, new FloatNode((Float) expect), decoder.decode(0));
} else if (type.equals(Decoder.Type.UTF8_STRING)) {
assertEquals(desc, expect, decoder.decode(0).asText());
} else if (type.equals(Decoder.Type.BOOLEAN)) {
assertEquals(desc, expect, decoder.decode(0).asBoolean());
} else {
assertEquals(desc, expect, decoder.decode(0));
}
} finally {
fc.close();
}
}
}
开发者ID:maxmind,项目名称:MaxMind-DB-Reader-java,代码行数:48,代码来源:DecoderTest.java
注:本文中的com.fasterxml.jackson.databind.node.FloatNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论