public static LongNode valueOf(long l) { return new LongNode(l); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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 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)); }
@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)); }
switch (JsonType.values()[in.readIndex()]) { case LONG: return new LongNode(in.readLong()); case DOUBLE: return new DoubleNode(in.readDouble());
case INTEGER_LITERAL: t = jj_consume_token(INTEGER_LITERAL); n = new LongNode(Long.parseLong(t.image)); break; case FLOATING_POINT_LITERAL:
return new LongNode(((Date) object).getTime()); } else if (object instanceof DataHandler) { DataHandler dataHandler = (DataHandler) object; return new TextNode((String) object); } else if (object instanceof Long) { return new LongNode((Long) object); } else if (object instanceof Integer) { return new IntNode((Integer) object);
/** * 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; }
@Override public List<JsonNode> apply(final Scope scope, final List<JsonQuery> args, final JsonNode in) throws JsonQueryException { return Collections.<JsonNode> singletonList(new LongNode(System.currentTimeMillis())); } }
public static JsonNode asNumericNode(final long value) { if (((int) value) == value) return new IntNode((int) value); return new LongNode((long) value); }
public static JsonNode asNumericNode(final long value) { if (((int) value) == value) return new IntNode((int) value); return new LongNode((long) value); }
public void respond(ObjectNode response) { final JsonNode id = checkHasId(response).get("id"); response.set(TIMESTAMP, new LongNode(System.nanoTime())); responses.add(response); requests.removeIf(request -> request.path("id").equals(id)); }
public JsonNode call(JsonNode input, JsonNode[] arguments) { JsonNode number = arguments[0]; if (number.isNull()) return NullNode.instance; else if (!number.isNumber()) throw new JsltException("floor() cannot round a non-number: " + number); return new LongNode((long) Math.floor(number.doubleValue())); } }
public JsonNode call(JsonNode input, JsonNode[] arguments) { JsonNode number = arguments[0]; if (number.isNull()) return NullNode.instance; else if (!number.isNumber()) throw new JsltException("ceiling() cannot round a non-number: " + number); return new LongNode((long) Math.ceil(number.doubleValue())); } }
public static JsonNode asNumericNode(final double value) { if (((int) value) == value) return new IntNode((int) value); if (((long) value) == value) return new LongNode((long) value); return new DoubleNode(value); }
public JsonNode perform(JsonNode v1, JsonNode v2) { if (v1.isNull() || v2.isNull()) return NullNode.instance; v1 = NodeUtils.number(v1, true, location); v2 = NodeUtils.number(v2, true, location); if (v1.isIntegralNumber() && v2.isIntegralNumber()) return new LongNode(perform(v1.longValue(), v2.longValue())); else return new DoubleNode(perform(v1.doubleValue(), v2.doubleValue())); }