本文整理汇总了Java中com.fasterxml.jackson.databind.node.LongNode.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java LongNode.valueOf方法的具体用法?Java LongNode.valueOf怎么用?Java LongNode.valueOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.node.LongNode
的用法示例。
在下文中一共展示了LongNode.valueOf方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toValueNode
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的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());
}
示例2: toValueNode
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的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());
}
示例3: evaluate
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的package包/类
@Override
public JsonNode evaluate(JsonNode node) {
JsonNode valueNode = super.evaluate(node);
if(valueNode!=null && valueNode.isNumber()) {
return LongNode.valueOf(Math.round(valueNode.asDouble()));
} else if (valueNode!=null && valueNode.isTextual()){
try {
Double doubleVal = Double.parseDouble(valueNode.asText());
return LongNode.valueOf(Math.round(doubleVal));
} catch(NumberFormatException e) {
throw new UnsupportedExprException("Value not parseable to a number");
}
} else {
throw new UnsupportedExprException("Value not a number or text to parse to a number");
}
}
示例4: primitiveToJson
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的package包/类
/**
* Serialize primtive values to JSON .
*/
static <T> JsonNode primitiveToJson(final T value, final TypeNode type) {
final JsonNode result;
// for BinaryTreeNode
if (value == null) {
return NullNode.instance;
}
switch (type.getValue()) {
case BOOL:
result = BooleanNode.valueOf((Boolean) value);
break;
case CHAR:
result = TextNode.valueOf(value.toString());
break;
case STRING:
result = TextNode.valueOf((String) value);
break;
case DOUBLE:
result = DoubleNode.valueOf((Double) value);
break;
case INT:
result = IntNode.valueOf((Integer) value);
break;
case LONG:
result = LongNode.valueOf((Long) value);
break;
default:
throw new IllegalArgumentException("Unrecognized primitive type: " + type);
}
return result;
}
示例5: test0
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的package包/类
@Test(timeout = 4000)
public void test0() throws Throwable {
LongNode longNode0 = LongNode.valueOf(1331L);
PostgresJSONJacksonJsonNodeConverter postgresJSONJacksonJsonNodeConverter0 = new PostgresJSONJacksonJsonNodeConverter();
// Undeclared exception!
try {
postgresJSONJacksonJsonNodeConverter0.to(longNode0);
fail("Expecting exception: VerifyError");
} catch (VerifyError e) {
//
// Bad type on operand stack
// Exception Details:
// Location:
// com/fasterxml/jackson/databind/ObjectMapper.<clinit>()V @62: invokespecial
// Reason:
// Type 'com/fasterxml/jackson/databind/util/StdDateFormat' (current frame, stack[8]) is not assignable to 'java/text/DateFormat'
// Current Frame:
// bci: @62
// flags: { }
// locals: { }
// stack: { uninitialized 35, uninitialized 35, null, 'com/fasterxml/jackson/databind/AnnotationIntrospector', 'com/fasterxml/jackson/databind/introspect/VisibilityChecker', null, 'com/fasterxml/jackson/databind/type/TypeFactory', null, 'com/fasterxml/jackson/databind/util/StdDateFormat', null, 'java/util/Locale', null, 'com/fasterxml/jackson/core/Base64Variant' }
// Bytecode:
// 0x0000000: 1304 16b8 06ef b304 14bb 06f1 59b7 06f2
// 0x0000010: b306 e5b8 06f5 b306 e7bb 06f7 59b7 06f8
// 0x0000020: b306 e9bb 0102 5901 b206 e5b2 06e7 01b8
// 0x0000030: 00f7 01b2 06fd 01b8 0703 01b8 0709 b707
// 0x0000040: 0cb3 00fc 1307 0eb8 0713 b113 070e b807
// 0x0000050: 13bf
// Exception Handler Table:
// bci [0, 75] => handler: 75
// Stackmap Table:
// same_locals_1_stack_item_extended(@75,Object[#1587])
//
assertThrownBy("com.chiralbehaviors.CoRE.postgres.PostgresJSONJacksonJsonNodeConverter",
e);
}
}
开发者ID:ChiralBehaviors,项目名称:Ultrastructure,代码行数:39,代码来源:PostgresJSONJacksonJsonNodeConverter_ESTest.java
示例6: generateValue
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的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();
}
示例7: Procedure
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的package包/类
public Procedure(RegisterMessage register, long registrationID, Session session){
this.register = register;
this.registrationID = LongNode.valueOf(registrationID);
this.session = session;
}
示例8: gt
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的package包/类
public static GtExpression gt(String property, Long value) {
return new GtExpression(val(property), LongNode.valueOf(value));
}
示例9: lt
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的package包/类
public static LtExpression lt(String property, Long value) {
return new LtExpression(val(property), LongNode.valueOf(value));
}
示例10: ge
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的package包/类
public static GeExpression ge(String property, Long value) {
return new GeExpression(val(property), LongNode.valueOf(value));
}
示例11: le
import com.fasterxml.jackson.databind.node.LongNode; //导入方法依赖的package包/类
public static LeExpression le(String property, Long value) {
return new LeExpression(val(property), LongNode.valueOf(value));
}