/** * @deprecated use Response(JsonNodeFactory) */ @Deprecated public Response() { jsonNodeFactory = JsonNodeFactory.withExactBigDecimals(true); }
public NotificationHook(String name, Mediator mediator) { this(name, new ObjectMapper(), JsonNodeFactory.withExactBigDecimals(true), mediator); }
/** * Returns an instance of JsonNodeFactory. Never returns null, if the * JsonNodeFactory is not initialized, this call initializes a default * instance. */ public JsonNodeFactory getNodeFactory() { if (nodeFactory == null) { setNodeFactory(JsonNodeFactory.withExactBigDecimals(true)); } return nodeFactory; }
public JsonNode intArrayNode(Integer[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (Integer value : expectedValues) { expectedNode.add(value); } return expectedNode; }
public JsonNode doubleArrayNode(Double[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (Double value : expectedValues) { expectedNode.add(value); } return expectedNode; }
/** * Returns an instance of JsonNodeFactory. Never returns null, if the * JsonNodeFactory is not initialized, this call initializes a default * instance. */ public JsonNodeFactory getNodeFactory() { if (nodeFactory == null) { setNodeFactory(JsonNodeFactory.withExactBigDecimals(true)); } return nodeFactory; }
public JsonNode stringArrayNode(String[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (String value : expectedValues) { expectedNode.add(value); } return expectedNode; }
public JsonNode stringArrayNode(String[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (String value : expectedValues) { expectedNode.add(value); } return expectedNode; }
public JsonNode stringArrayNode(String[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (String value : expectedValues) { expectedNode.add(value); } return expectedNode; }
public JsonNode intArrayNode(Integer[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (Integer value : expectedValues) { expectedNode.add(value); } return expectedNode; }
public JsonNode doubleArrayNode(Double[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (Double value : expectedValues) { expectedNode.add(value); } return expectedNode; }
public JsonNode intArrayNode(Integer[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (Integer value : expectedValues) { expectedNode.add(value); } return expectedNode; }
public JsonNode doubleArrayNode(Double[] expectedValues) { ArrayNode expectedNode = JsonNodeFactory.withExactBigDecimals(true).arrayNode(); for (Double value : expectedValues) { expectedNode.add(value); } return expectedNode; }
/** * Returns an instance of JsonNodeFactory. Never returns null, if the * JsonNodeFactory is not initialized, this call initializes a default * instance. */ public JsonNodeFactory getNodeFactory() { if (nodeFactory == null) { setNodeFactory(JsonNodeFactory.withExactBigDecimals(true)); } return nodeFactory; }
private void readDelimitedData(String lookup, List<String> lines) { Splitter splitter; if (lookup.matches(".*\\.csv")) { splitter = Splitter.on(","); } else if (lookup.matches(".*\\.tsv")) { splitter = Splitter.on("\t"); } else { throw new IllegalArgumentException("Must have file with .csv, .tsv or .json suffix"); } List<String> names = Lists.newArrayList(splitter.split(lines.get(0))); JsonNodeFactory nf = JsonNodeFactory.withExactBigDecimals(false); ArrayNode localData = nf.arrayNode(); for (String line : lines.subList(1, lines.size())) { ObjectNode r = nf.objectNode(); List<String> fields = Lists.newArrayList(splitter.split(line)); Preconditions.checkState(names.size() == fields.size(), "Wrong number of fields, expected ", names.size(), fields.size()); Iterator<String> ix = names.iterator(); for (String field : fields) { r.put(ix.next(), field); } localData.add(r); } data = localData; }
@Override public JsonNode sample() { double step; if (stepDistribution == null) { step = rand.nextGaussian() * sd.sample().asDouble() + mean.sample().asDouble(); } else { step = stepDistribution.sample().asDouble(); } double newState = state.addAndGet(step); if (verbose) { ObjectNode r = new ObjectNode(JsonNodeFactory.withExactBigDecimals(false)); r.set("value", new DoubleNode(newState)); r.set("step", new DoubleNode(step)); return r; } else { return new DoubleNode(newState); } }
/** * Creates an instance of {@link JSONMetadataParser}. * * @param backend - Name of backend to use. * @param fieldConstraintParsers - <i>(optional)</i> * {@link FieldConstraintParser}s to register on the {@link Extensions} used * to parse the {@link EntityMetadata}. If <code>null</code> then nothing * will be set. * @return An instance of {@link JSONMetadataParser}. */ public static JSONMetadataParser createJSONMetadataParser( String backend, Map<String, ? extends FieldConstraintParser<JsonNode>> fieldConstraintParsers) { FakeDataStoreParser<JsonNode> dsParser = new FakeDataStoreParser<>(backend); Extensions<JsonNode> extensions = new Extensions<>(); extensions.registerDataStoreParser(dsParser.getDefaultName(), dsParser); extensions.addDefaultExtensions(); if (fieldConstraintParsers != null) { for (Entry<String, ? extends FieldConstraintParser<JsonNode>> checker : fieldConstraintParsers.entrySet()) { extensions.registerFieldConstraintParser(checker.getKey(), checker.getValue()); } } return new JSONMetadataParser( extensions, new DefaultTypes(), JsonNodeFactory.withExactBigDecimals(false)); }