public static LongNode valueOf(long l) { return new LongNode(l); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit integer value */ @Override public NumericNode numberNode(long v) { return LongNode.valueOf(v); }
return ((LongNode) node).longValue();
/** * Sets the expected value for this condition. * * @param expectedValue Expected value. * @return This object for method chaining. */ public Builder expectedValue(long expectedValue) { this.expectedValue = new LongNode(expectedValue); return this; }
/** * Alternate factory method that will handle wrapper value, which may be null. * Due to possibility of null, returning type is not guaranteed to be * {@link NumericNode}, but just {@link ValueNode}. */ @Override public ValueNode numberNode(Long v) { if (v == null) { return nullNode(); } return LongNode.valueOf(v.longValue()); }
/** * Sets the expected value for this condition. * * @param expectedValue Expected value. * @return This object for method chaining. */ public Builder expectedValue(long expectedValue) { this.expectedValue = new LongNode(expectedValue); return this; }
@Test public void testToJsonNode() { assertEquals(null, toJsonNode(null)); assertEquals(NullNode.getInstance(), toJsonNode(JsonProperties.NULL_VALUE)); assertEquals(BooleanNode.TRUE, toJsonNode(true)); assertEquals(IntNode.valueOf(1), toJsonNode(1)); assertEquals(LongNode.valueOf(2), toJsonNode(2L)); assertEquals(FloatNode.valueOf(1.0f), toJsonNode(1.0f)); assertEquals(DoubleNode.valueOf(2.0), toJsonNode(2.0)); assertEquals(TextNode.valueOf("\u0001\u0002"), toJsonNode(new byte[] { 1, 2 })); assertEquals(TextNode.valueOf("a"), toJsonNode("a")); assertEquals(TextNode.valueOf("UP"), toJsonNode(Direction.UP)); ArrayNode an = JsonNodeFactory.instance.arrayNode(); an.add(1); assertEquals(an, toJsonNode(Collections.singletonList(1))); ObjectNode on = JsonNodeFactory.instance.objectNode(); on.put("a", 1); assertEquals(on, toJsonNode(Collections.singletonMap("a", 1))); }
/** * Sets the expected value for this condition. * * @param expectedValue Expected value. * @return This object for method chaining. */ public Builder expectedValue(long expectedValue) { this.expectedValue = new LongNode(expectedValue); return this; }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit integer value */ public NumericNode numberNode(long v) { return LongNode.valueOf(v); }
/** * Sets the expected value for this condition. * * @param expectedValue Expected value. * @return This object for method chaining. */ public Builder expectedValue(long expectedValue) { this.expectedValue = new LongNode(expectedValue); return this; }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit integer value */ public NumericNode numberNode(long v) { return LongNode.valueOf(v); }
/** * Sets the expected value for this condition. * * @param expectedValue Expected value. * @return This object for method chaining. */ public Builder expectedValue(long expectedValue) { this.expectedValue = new LongNode(expectedValue); return this; }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit integer value */ @Override public NumericNode numberNode(long v) { return LongNode.valueOf(v); }
@Test public void shouldGetDateWhenParsingNumericNode() throws Exception { Map<String, JsonNode> tree = new HashMap<>(); long seconds = 1478627949 / 1000; LongNode node = new LongNode(seconds); tree.put("key", node); Date date = deserializer.getDateFromSeconds(tree, "key"); assertThat(date, is(notNullValue())); assertThat(date.getTime(), is(seconds * 1000)); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given 64-bit integer value */ @Override public NumericNode numberNode(long v) { return LongNode.valueOf(v); }
@Test public void shouldGetLargeDateWhenParsingNumericNode() throws Exception { Map<String, JsonNode> tree = new HashMap<>(); long seconds = Integer.MAX_VALUE + 10000L; LongNode node = new LongNode(seconds); tree.put("key", node); Date date = deserializer.getDateFromSeconds(tree, "key"); assertThat(date, is(notNullValue())); assertThat(date.getTime(), is(seconds * 1000)); assertThat(date.getTime(), is(2147493647L * 1000)); }
@Override public JsonNode serialize(Long object) { return LongNode.valueOf(object); }
switch (JsonType.values()[in.readIndex()]) { case LONG: return new LongNode(in.readLong()); case DOUBLE: return new DoubleNode(in.readDouble());
public Atom(long value, long expires) { this(LongNode.valueOf(value), expires); }