com.fasterxml.jackson.databind.node.ObjectNode.with()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.fasterxml.jackson.databind.node.ObjectNode.with()方法的一些代码示例,展示了ObjectNode.with()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.with()方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.node.ObjectNode
类名称:ObjectNode
方法名:with

ObjectNode.with介绍

[英]Method for removing field entry from this ObjectNode, and returning instance after removal.
[中]方法,用于从此ObjectNode中删除字段条目,并在删除后返回实例。

代码示例

代码示例来源:origin: org.apache.taverna.engine/taverna-run-impl

@SuppressWarnings("unused")
private void injectContext(ObjectNode objNode) {
  ObjectNode context = objNode.with("@context");
  context.put("wfprov", "http://purl.org/wf4ever/wfprov#");
  context.put("wfdesc", "http://purl.org/wf4ever/wfdesc#");
  context.put("prov", "http://www.w3.org/ns/prov#");
}

代码示例来源:origin: org.n52.iceland/iceland

protected void setStatus(String path, Predicate<JsonNode> matcher,
             Function<Supplier<ObjectNode>, Supplier<ObjectNode>> encoder,
             boolean active) {
  writeLock().lock();
  try {
    ArrayNode array = getConfiguration().with(JsonConstants.ACTIVATION).withArray(path);
    ObjectNode node = (ObjectNode) createStream(array).filter(matcher).findAny()
        .orElseGet(encoder.apply(array::addObject));
    node.put(JsonConstants.ACTIVE, active);
  } finally {
    writeLock().unlock();
  }
  configuration().scheduleWrite();
}

代码示例来源:origin: com.almende.eve/eve-planning

/**
 * Convert the event from a Eve event to a Google event
 * 
 * @param event
 */
private void toGoogleEvent(ObjectNode event) {
  if (event.has("agent") && event.get("agent").isTextual()) {
    // move agent url from event.agent to extendedProperties
    String agent = event.get("agent").asText();
    event.with("extendedProperties").with("shared").put("agent", agent);
    // TODO: change location into a string
  }
}

代码示例来源:origin: mevdschee/java-crud-api

public void set(String path, Object value)
{
  String[] parts = path.replaceAll("\\|$|^\\|", "").split("\\|");
  ObjectNode current = root;
  for (int i=0;i<parts.length-1;i++) {
    String part = parts[i];
    current = current.with(part);
  }
  if (value instanceof Boolean) {
    current.put(parts[parts.length - 1], (Boolean) value);
  } else {
    current.put(parts[parts.length - 1], value.toString());
  }
}

代码示例来源:origin: com.almende.eve/eve-protocol-jsonrpc

/**
 * Put param.
 * 
 * @param name
 *            the name
 * @param value
 *            the value
 */
public void putParam(final String name, final Object value) {
  final ObjectMapper mapper = JOM.getInstance();
  req.with(PARAMS).set(name, mapper.convertValue(value, JsonNode.class));
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-richtext-ckeditor-frontend

private void addImagePickerConfiguration(final ObjectNode pickerPluginConfig) {
  final ObjectNode config = pickerPluginConfig.with(HippoPicker.Image.CONFIG_KEY);
  addCallbackUrl(config, HippoPicker.Image.CONFIG_CALLBACK_URL, imagePicker);
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-richtext-ckeditor-frontend

private void addInternalLinkPickerConfiguration(final ObjectNode pickerPluginConfig) {
  final ObjectNode config = pickerPluginConfig.with(HippoPicker.InternalLink.CONFIG_KEY);
  addCallbackUrl(config, HippoPicker.InternalLink.CONFIG_CALLBACK_URL, linkPicker);
}

代码示例来源:origin: com.almende.eve/eve-protocol-jsonrpc

/**
 * Gets the param.
 * 
 * @param name
 *            the name
 * @return the param
 */
public Object getParam(final String name) {
  final ObjectMapper mapper = JOM.getInstance();
  final ObjectNode params = req.with(PARAMS);
  if (params.has(name)) {
    return mapper.convertValue(params.get(name), Object.class);
  }
  return null;
}

代码示例来源:origin: 52North/SOS

private Stream<StringBasedCapabilitiesExtension> capabilitiesExtensionStream() {
  return createEntryStream(getConfiguration().with(JsonConstants.CAPABILITIES_EXTENSIONS))
      .map(this::decodeCapabilitiesExtension);
}

代码示例来源:origin: us.ihmc/ihmc-pub-sub-serializers-extra

/**
* Struct
*/
public <T> void read_type_a(String name, TopicDataType<T> type, T data)
{
 type.deserialize(new JacksonInterchangeSerializer(node.with(name), supportsArrays), data);
}

代码示例来源:origin: 52North/SOS

@Override
public void saveCapabilitiesExtension(String identifier, String value) {
  writeLock().lock();
  try {
    getConfiguration()
        .with(JsonConstants.CAPABILITIES_EXTENSIONS)
        .with(identifier)
        .put(JsonConstants.EXTENSION, value);
  } finally {
    writeLock().unlock();
  }
  configuration().scheduleWrite();
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-richtext-ckeditor-frontend

@Override
public void addConfiguration(final ObjectNode editorConfig) throws IOException {
  final ObjectNode pickerPluginConfig = editorConfig.with(HippoPicker.CONFIG_KEY);
  addInternalLinkPickerConfiguration(pickerPluginConfig);
  addImagePickerConfiguration(pickerPluginConfig);
}

代码示例来源:origin: us.ihmc/IHMCPubSubSerializersExtra

/**
* Struct
*/
public <T> void read_type_a(String name, TopicDataType<T> type, T data)
{
 type.deserialize(new JacksonInterchangeSerializer(node.with(name), supportsArrays), data);
}

代码示例来源:origin: 52North/SOS

@Override
public void saveStaticCapabilities(String identifier, String document) {
  writeLock().lock();
  try {
    getConfiguration()
        .with(JsonConstants.STATIC_CAPABILITIES)
        .with(JsonConstants.CAPABILITIES)
        .put(identifier, document);
  } finally {
    writeLock().unlock();
  }
  configuration().scheduleWrite();
}

代码示例来源:origin: 52North/SOS

private Stream<SosObservationOfferingExtension> offeringExtensionStream() {
  return createEntryStream(getConfiguration().with(JsonConstants.OFFERING_EXTENSIONS)).flatMap(entry
      -> createEntryStream(entry.getValue())
          .map(this::decodeOfferingExtension)
          .map(Functions.mutate(Consumers
              .currySecond(SosObservationOfferingExtensionImpl::setOfferingName, entry.getKey()))));
}

代码示例来源:origin: org.n52.faroe/faroe-json

@Override
public void deleteSettingValue(String key) {
  writeLock().lock();
  try {
    getConfiguration().with(JSONSettingConstants.SETTINGS_KEY).remove(key);
  } finally {
    writeLock().unlock();
  }
  configuration().scheduleWrite();
}

代码示例来源:origin: org.onehippo.cms7/hippo-addon-channel-manager-content-service

@Override
public FieldsInformation init(final FieldTypeContext fieldContext) {
  final FieldsInformation fieldsInfo = super.init(fieldContext);
  final ObjectNode hippoPickerConfig = getConfig().with(HippoPicker.CONFIG_KEY);
  initInternalLinkPicker(fieldContext, hippoPickerConfig);
  initImagePicker(fieldContext, hippoPickerConfig);
  return fieldsInfo;
}

代码示例来源:origin: org.n52.iceland/iceland

@Override
public void saveAdminUser(AdministratorUser user) {
  configuration().writeLock().lock();
  try {
    getConfiguration().with(JsonConstants.USERS).put(user.getUsername(), user.getPassword());
    configuration().writeNow();
  } finally {
    configuration().writeLock().unlock();
  }
}

代码示例来源:origin: org.n52.iceland/iceland

@Override
public void deleteAdminUser(String username) {
  configuration().writeLock().lock();
  try {
    getConfiguration().with(JsonConstants.USERS).remove(username);
    configuration().scheduleWrite();
  } finally {
    configuration().writeLock().unlock();
  }
}

代码示例来源:origin: 52North/SOS

@Override
public void deleteCapabiltiesExtension(String identfier) throws NoSuchExtensionException {
  writeLock().lock();
  try {
    JsonNode removed = getConfiguration()
        .with(JsonConstants.CAPABILITIES_EXTENSIONS)
        .remove(identfier);
    if (removed == null) {
      throw new NoSuchExtensionException(identfier);
    }
  } finally {
    writeLock().unlock();
  }
  configuration().scheduleWrite();
}

相关文章

微信公众号

最新文章

更多