本文整理了Java中com.fasterxml.jackson.databind.node.ObjectNode.setAll()
方法的一些代码示例,展示了ObjectNode.setAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.setAll()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.node.ObjectNode
类名称:ObjectNode
方法名:setAll
[英]Method for adding all properties of the given Object, overriding any existing values for those properties.
[中]方法,用于添加给定对象的所有属性,覆盖这些属性的任何现有值。
代码示例来源:origin: redisson/redisson
/**
* Method for adding given properties to this object node, overriding
* any existing values for those properties.
*
* @param properties Properties to add
*
* @return This node after adding/replacing property values (to allow chaining)
*
* @deprecated Since 2.4 use {@link #setAll(Map)},
*/
@Deprecated
public JsonNode putAll(Map<String,? extends JsonNode> properties) {
return setAll(properties);
}
代码示例来源:origin: redisson/redisson
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*
* @deprecated Since 2.4 use {@link #setAll(ObjectNode)},
*/
@Deprecated
public JsonNode putAll(ObjectNode other) {
return setAll(other);
}
代码示例来源:origin: stagemonitor/stagemonitor
private JsonNode merge(JsonNode source, JsonNode replacement) throws IOException {
JsonNode replacementNodeEncoded = replacement.get(fieldName);
if (replacementNodeEncoded != null) {
ObjectNode decodedSource = tryDecode(source.get(fieldName), mapper.createObjectNode(), fieldName);
decodedSource.setAll(tryDecode(replacement.get(fieldName), mapper.createObjectNode(), fieldName));
return TextNode.valueOf(mapper.writeValueAsString(decodedSource));
} else {
return source.get(fieldName);
}
}
代码示例来源:origin: docker-java/docker-java
@Nonnull
protected String registryConfigs(@Nonnull AuthConfigurations authConfigs) {
try {
final String json;
final ObjectMapper objectMapper = new ObjectMapper();
final RemoteApiVersion apiVersion = dockerClientConfig.getApiVersion();
if (apiVersion.equals(UNKNOWN_VERSION)) {
ObjectNode rootNode = objectMapper.valueToTree(authConfigs.getConfigs()); // all registries
final ObjectNode authNodes = objectMapper.valueToTree(authConfigs); // wrapped in "configs":{}
rootNode.setAll(authNodes); // merge 2 variants
json = rootNode.toString();
} else if (apiVersion.isGreaterOrEqual(VERSION_1_19)) {
json = objectMapper.writeValueAsString(authConfigs.getConfigs());
} else {
json = objectMapper.writeValueAsString(authConfigs);
}
return BaseEncoding.base64Url().encode(json.getBytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: docker-java/docker-java
protected String registryConfigs(AuthConfigurations authConfigs) {
try {
final String json;
final ObjectMapper objectMapper = new ObjectMapper();
final RemoteApiVersion apiVersion = dockerClientConfig.getApiVersion();
if (apiVersion.equals(UNKNOWN_VERSION)) {
ObjectNode rootNode = objectMapper.valueToTree(authConfigs.getConfigs()); // all registries
final ObjectNode authNodes = objectMapper.valueToTree(authConfigs); // wrapped in "configs":{}
rootNode.setAll(authNodes); // merge 2 variants
json = rootNode.toString();
} else if (apiVersion.isGreaterOrEqual(VERSION_1_19)) {
json = objectMapper.writeValueAsString(authConfigs.getConfigs());
} else {
json = objectMapper.writeValueAsString(authConfigs);
}
return BaseEncoding.base64Url().encode(json.getBytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: zendesk/maxwell
throw new ParseException("`encrypted` must be an object after decrypting.");
node.setAll((ObjectNode) decrypted);
代码示例来源:origin: lenskit/lenskit
/**
* Construct a JSON representation of this entity source, suitable for serialization to e.g. YAML.
*
* @param base The URI of the YAML file that will be generated, to generate relative URLs.
* @return The JSON node.
*/
public JsonNode toJSON(@Nullable URI base) {
Path basePath = null;
if (base != null) {
try {
basePath = Paths.get(base).getParent();
} catch (FileSystemNotFoundException ex) {
/* this is ok, just means we can't resolve the base URI */
}
}
JsonNodeFactory nf = JsonNodeFactory.instance;
ObjectNode object = nf.objectNode();
object.put("type", "textfile");
Path path = getFile();
if (basePath != null) {
path = basePath.relativize(path);
}
object.put("file", path.toString().replace(File.separatorChar, '/'));
object.setAll(format.toJSON());
return object;
}
代码示例来源:origin: rakam-io/rakam
@Test
public void testChangeSchemaSetProperties()
throws Exception {
AbstractUserService userService = getUserService();
userService.setUserProperties(PROJECT_NAME, 4, sampleProperties);
ObjectNode newProperties = JsonHelper.jsonObject()
.put("test100", 1.0)
.put("test200", "value")
.put("test400", true);
userService.setUserProperties(PROJECT_NAME, 4, newProperties);
User test = userService.getUser(CONTEXT, 4).join();
assertEquals(test.id, 4);
ObjectNode builder = JsonHelper.jsonObject();
builder.setAll(samplePropertiesExpected);
builder.setAll(newProperties);
assertEquals((Object) test.properties, builder);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*<p>
* NOTE: this method will be <b>deprecated</b> in 2.2; and should
* be replace with {@link #setAll(ObjectNode)}.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*/
public JsonNode putAll(ObjectNode other) {
return setAll(other);
}
代码示例来源:origin: Nextdoor/bender
/**
* Method for adding given properties to this object node, overriding
* any existing values for those properties.
*
* @param properties Properties to add
*
* @return This node after adding/replacing property values (to allow chaining)
*
* @deprecated Since 2.4 use {@link #setAll(Map)},
*/
@Deprecated
public JsonNode putAll(Map<String,? extends JsonNode> properties) {
return setAll(properties);
}
代码示例来源:origin: Nextdoor/bender
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*
* @deprecated Since 2.4 use {@link #setAll(ObjectNode)},
*/
@Deprecated
public JsonNode putAll(ObjectNode other) {
return setAll(other);
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Method for adding given properties to this object node, overriding
* any existing values for those properties.
*
* @param properties Properties to add
*
* @return This node after adding/replacing property values (to allow chaining)
*
* @deprecated Since 2.4 use {@link #setAll(Map)},
*/
@Deprecated
public JsonNode putAll(Map<String,? extends JsonNode> properties) {
return setAll(properties);
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Method for adding all properties of the given Object, overriding
* any existing values for those properties.
*
* @param other Object of which properties to add to this object
*
* @return This node (to allow chaining)
*
* @deprecated Since 2.4 use {@link #setAll(ObjectNode)},
*/
@Deprecated
public JsonNode putAll(ObjectNode other) {
return setAll(other);
}
代码示例来源:origin: com.almis.awe/awe-model
/**
* Store the parameter list
*
* @param parameterList the parameterList to set
*/
public void setParameterList(ObjectNode parameterList) {
if (parameterList != null) {
getParameterList().setAll(parameterList);
}
}
代码示例来源:origin: io.syndesis.server/server-api-generator
public static ObjectNode createJsonSchema(final String title, final ObjectNode schema) {
final ObjectNode schemaNode = newJsonObjectSchema();
if (title != null) {
schemaNode.put("title", title);
}
schemaNode.setAll(schema);
return schemaNode;
}
代码示例来源:origin: com.almende.eve/eve-protocol-jsonrpc
/**
* Sets the params.
*
* @param params
* the new params
*/
public void setParams(final ObjectNode params) {
final ObjectNode newParams = JOM.createObjectNode();
if (params != null) {
newParams.setAll(params);
}
req.set(PARAMS, newParams);
}
代码示例来源:origin: io.syndesis.server/server-connector-generator
public static ObjectNode createJsonSchema(final String title, final ObjectNode schema) {
final ObjectNode schemaNode = newJsonObjectSchema();
if (title != null) {
schemaNode.put("title", title);
}
schemaNode.setAll(schema);
return schemaNode;
}
代码示例来源:origin: org.flowable/flowable-engine
@Override
protected ObjectNode convertMappingInfoToJson(ActivityMigrationMapping.OneToManyMapping mapping, ObjectMapper objectMapper) {
ObjectNode mappingNode = objectMapper.createObjectNode();
mappingNode.put(FROM_ACTIVITY_ID_JSON_PROPERTY, mapping.getFromActivityId());
JsonNode toActivityIdsNode = objectMapper.valueToTree(mapping.getToActivityIds());
mappingNode.set(TO_ACTIVITY_IDS_JSON_PROPERTY, toActivityIdsNode);
mappingNode.setAll(convertAdditionalMappingInfoToJson(mapping, objectMapper));
return mappingNode;
}
代码示例来源:origin: org.flowable/flowable-engine
@Override
protected ObjectNode convertMappingInfoToJson(ActivityMigrationMapping.ManyToOneMapping mapping, ObjectMapper objectMapper) {
ObjectNode mappingNode = objectMapper.createObjectNode();
JsonNode fromActivityIdsNode = objectMapper.valueToTree(mapping.getFromActivityIds());
mappingNode.set(FROM_ACTIVITY_IDS_JSON_PROPERTY, fromActivityIdsNode);
mappingNode.put(TO_ACTIVITY_ID_JSON_PROPERTY, mapping.getToActivityId());
mappingNode.setAll(convertAdditionalMappingInfoToJson(mapping, objectMapper));
return mappingNode;
}
代码示例来源:origin: org.flowable/flowable-engine
@Override
protected ObjectNode convertMappingInfoToJson(ActivityMigrationMapping.OneToOneMapping mapping, ObjectMapper objectMapper) {
ObjectNode mappingNode = objectMapper.createObjectNode();
mappingNode.put(FROM_ACTIVITY_ID_JSON_PROPERTY, mapping.getFromActivityId());
mappingNode.put(TO_ACTIVITY_ID_JSON_PROPERTY, mapping.getToActivityId());
mappingNode.setAll(convertAdditionalMappingInfoToJson(mapping, objectMapper));
return mappingNode;
}
内容来源于网络,如有侵权,请联系作者删除!