List of usage examples for com.fasterxml.jackson.databind.node ArrayNode add
public ArrayNode add(JsonNode paramJsonNode)
From source file:org.openepics.discs.ccdb.core.auditlog.AuditLogUtil.java
/** * Adds an array of {@link String}s to the JSON under a key * * @param key the key// ww w . ja va 2 s .com * @param arrayValues they list of values * @return a reference to this instance of {@link AuditLogUtil} */ public AuditLogUtil addArrayOfProperties(String key, List<String> arrayValues) { // Don't add anything if empty if (arrayValues.isEmpty()) { return this; } final ArrayNode arrayNode = MAPPER.createArrayNode(); for (String value : arrayValues) { arrayNode.add(value); } node.set(key, arrayNode); return this; }
From source file:com.unboundid.scim2.common.messages.PatchOperation.java
/** * Create a new add patch operation.//from ww w . j av a 2 s . co m * * @param path The path targeted by this patch operation. The path * must not be {@code null}. * @param values The values to add. * * @return The new add patch operation. */ public static PatchOperation addStringValues(final Path path, final List<String> values) { ArrayNode arrayNode = JsonUtils.getJsonNodeFactory().arrayNode(); for (String value : values) { arrayNode.add(value); } return add(path, arrayNode); }
From source file:com.unboundid.scim2.common.messages.PatchOperation.java
/** * Create a new add patch operation./*from w w w . j av a2 s . com*/ * * @param path The path targeted by this patch operation. The path * must not be {@code null}. * @param values The values to add. * * @return The new add patch operation. */ public static PatchOperation addDoubleValues(final Path path, final List<Double> values) { ArrayNode arrayNode = JsonUtils.getJsonNodeFactory().arrayNode(); for (Double value : values) { arrayNode.add(value); } return add(path, arrayNode); }
From source file:com.unboundid.scim2.common.messages.PatchOperation.java
/** * Create a new add patch operation./*from w w w . ja va 2s . co m*/ * * @param path The path targeted by this patch operation. The path * must not be {@code null}. * @param values The values to add. * * @return The new add patch operation. */ public static PatchOperation addBinaryValues(final Path path, final List<byte[]> values) { ArrayNode arrayNode = JsonUtils.getJsonNodeFactory().arrayNode(); for (byte[] value : values) { arrayNode.add(Base64Variants.getDefaultVariant().encode(value)); } return add(path, arrayNode); }
From source file:edu.nwpu.gemfire.monitor.service.ClusterGCPausesService.java
public ObjectNode execute(final HttpServletRequest request) throws Exception { // get cluster object Cluster cluster = Repository.get().getCluster(); // json object to be sent as response ObjectNode responseJSON = mapper.createObjectNode(); // cluster's GC Pauses trend added to json response object ArrayNode pauses = mapper.createArrayNode(); for (Object obj : cluster.getStatisticTrend(Cluster.CLUSTER_STAT_GARBAGE_COLLECTION)) { if (obj instanceof Number) { pauses.add(((Number) obj).longValue()); }//from ww w .j av a2 s. co m } responseJSON.put("currentGCPauses", cluster.getGarbageCollectionCount()); responseJSON.put("gCPausesTrend", pauses); // Send json response return responseJSON; }
From source file:com.unboundid.scim2.common.messages.PatchOperation.java
/** * Create a new add patch operation.//from www . ja v a 2s. com * * @param path The path targeted by this patch operation. The path * must not be {@code null}. * @param values The values to add. * * @return The new add patch operation. */ public static PatchOperation addBooleanValues(final Path path, final List<Boolean> values) { ArrayNode arrayNode = JsonUtils.getJsonNodeFactory().arrayNode(); for (Boolean value : values) { arrayNode.add(value); } return add(path, arrayNode); }
From source file:com.unboundid.scim2.common.messages.PatchOperation.java
/** * Create a new add patch operation./*from w ww .j a va 2 s . c o m*/ * * @param path The path targeted by this patch operation. The path * must not be {@code null}. * @param values The values to add. * * @return The new add patch operation. */ public static PatchOperation addIntegerValues(final Path path, final List<Integer> values) { ArrayNode arrayNode = JsonUtils.getJsonNodeFactory().arrayNode(); for (Integer value : values) { arrayNode.add(value); } return add(path, arrayNode); }
From source file:fr.gouv.vitam.query.construct.request.PathRequest.java
/** * Add other paths (at end) to a PATH Request * * @param pathes/*from ww w . j av a2 s .c o m*/ * @return this PathRequest * @throws InvalidCreateOperationException */ public final PathRequest addPath(final String... pathes) throws InvalidCreateOperationException { if (currentREQUEST != REQUEST.path) { throw new InvalidCreateOperationException( "Path cannot be added since this is not a path query: " + currentREQUEST); } final ArrayNode array = ((ArrayNode) currentObject); for (final String elt : pathes) { if (elt == null || elt.trim().isEmpty()) { continue; } array.add(elt.trim()); } return this; }
From source file:com.github.fge.jsonschema.matchers.ProcessingMessageAssert.java
public <T> ProcessingMessageAssert hasField(final String name, final Collection<T> value) { assertThat(msg.has(name)).isTrue();// w w w .ja v a 2 s. c o m final JsonNode node = msg.get(name); assertThat(node.isArray()).isTrue(); final ArrayNode input = JacksonUtils.nodeFactory().arrayNode(); for (final T element : value) input.add(element.toString()); assertEquals(node, input); return this; }
From source file:org.n52.io.geojson.GeoJSONEncoder.java
protected ArrayNode encodeCoordinates(Polygon geometry) { ArrayNode list = jsonFactory.arrayNode(); list.add(encodeCoordinates(geometry.getExteriorRing())); for (int i = 0; i < geometry.getNumInteriorRing(); ++i) { list.add(encodeCoordinates(geometry.getInteriorRingN(i))); }/*from w ww. j a v a 2 s .c om*/ return list; }