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

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

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

ObjectNode.objectNode介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

@Override
public ObjectNode with(String propertyName) {
  JsonNode n = _children.get(propertyName);
  if (n != null) {
    if (n instanceof ObjectNode) {
      return (ObjectNode) n;
    }
    throw new UnsupportedOperationException("Property '" + propertyName
      + "' has value that is not of type ObjectNode (but " + n
      .getClass().getName() + ")");
  }
  ObjectNode result = objectNode();
  _children.put(propertyName, result);
  return result;
}

代码示例来源:origin: redisson/redisson

/**
 * Method that will construct an ObjectNode and add it as a
 * field of this ObjectNode, replacing old value, if any.
 *<p>
 * <b>NOTE</b>: Unlike all <b>put(...)</b> methods, return value
 * is <b>NOT</b> this <code>ObjectNode</code>, but the
 * <b>newly created</b> <code>ObjectNode</code> instance.
 *
 * @return Newly constructed ObjectNode (NOT the old value,
 *   which could be of any type)
 */
public ObjectNode putObject(String fieldName)
{
  ObjectNode n = objectNode();
  _put(fieldName, n);
  return n;
}

代码示例来源:origin: embulk/embulk

@Override
public DataSourceImpl getNestedOrSetEmpty(String attrName) {
  JsonNode json = data.get(attrName);
  if (json == null) {
    json = data.objectNode();
    data.set(attrName, json);
  } else if (!json.isObject()) {
    throw new ConfigException("Attribute " + attrName + " must be an object");
  }
  return newInstance(model, (ObjectNode) json);
}

代码示例来源:origin: embulk/embulk

@Override
public DataSourceImpl getNestedOrGetEmpty(String attrName) {
  JsonNode json = data.get(attrName);
  if (json == null) {
    json = data.objectNode();
  } else if (!json.isObject()) {
    throw new ConfigException("Attribute " + attrName + " must be an object");
  }
  return newInstance(model, (ObjectNode) json);
}

代码示例来源:origin: dropwizard/dropwizard

child = obj.get(key);
if (child == null) {
  child = obj.objectNode();
  obj.set(key, child);

代码示例来源:origin: redisson/redisson

ObjectNode propertiesNode = o.objectNode();
final PropertyFilter filter;
if (_propertyFilterId != null) {

代码示例来源:origin: ethereum/ethereumj

@SuppressWarnings("uncheked")
  public static void dumpState(ObjectNode statesNode, String address, AccountState state, ContractDetails details) {

    List<DataWord> storageKeys = new ArrayList<>(details.getStorage().keySet());
    Collections.sort(storageKeys);

    ObjectNode account = statesNode.objectNode();
    ObjectNode storage = statesNode.objectNode();

    for (DataWord key : storageKeys) {
      storage.put("0x" + Hex.toHexString(key.getData()),
          "0x" + Hex.toHexString(details.getStorage().get(key).getNoLeadZeroesData()));
    }

    if (state == null)
      state = new AccountState(SystemProperties.getDefault().getBlockchainConfig().getCommonConstants().getInitialNonce(),
          BigInteger.ZERO);

    account.put("balance", state.getBalance() == null ? "0" : state.getBalance().toString());
//        account.put("codeHash", details.getCodeHash() == null ? "0x" : "0x" + Hex.toHexString(details.getCodeHash()));
    account.put("code", details.getCode() == null ? "0x" : "0x" + Hex.toHexString(details.getCode()));
    account.put("nonce", state.getNonce() == null ? "0" : state.getNonce().toString());
    account.set("storage", storage);
    account.put("storage_root", state.getStateRoot() == null ? "" : Hex.toHexString(state.getStateRoot()));

    statesNode.set(address, account);
  }

代码示例来源:origin: ethereum/ethereumj

blockNode.put("prevhash", "0x" + Hex.toHexString(block.getParentHash()));
ObjectNode statesNode = blockNode.objectNode();
for (ByteArrayWrapper key : keys) {
  byte[] keyBytes = key.getData();

代码示例来源:origin: org.fujion/fujion-core

/**
 * Returns the map node for the configuration, creating one if it does not exist.
 *
 * @return The map node.
 */
private ObjectNode getOrCreateMapNode() {
  ObjectNode map = (ObjectNode) config.get("map");
  if (map == null) {
    config.set("map", map = config.objectNode());
  }
  return map;
}

代码示例来源:origin: org.carewebframework/org.carewebframework.web.core

/**
 * Returns the map node for the configuration, creating one if it does not exist.
 *
 * @return The map node.
 */
private ObjectNode getOrCreateMapNode() {
  ObjectNode map = (ObjectNode) config.get("map");
  
  if (map == null) {
    config.set("map", map = config.objectNode());
  }
  
  return map;
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

@Override
public ObjectNode with(String propertyName) {
  JsonNode n = _children.get(propertyName);
  if (n != null) {
    if (n instanceof ObjectNode) {
      return (ObjectNode) n;
    }
    throw new UnsupportedOperationException("Property '" + propertyName
      + "' has value that is not of type ObjectNode (but " + n
      .getClass().getName() + ")");
  }
  ObjectNode result = objectNode();
  _children.put(propertyName, result);
  return result;
}

代码示例来源:origin: org.n52.arctic-sea/svalbard-json

private void encodeScalarCapabilities(ObjectNode jfc, FilterCapabilities fc) {
  ObjectNode sfc = jfc.objectNode();
  // FIXME scalar filter capabilities
  if (sfc.size() > 0) {
    jfc.set(JSONConstants.SCALAR, sfc);
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/coding-json

private void encodeScalarCapabilities(ObjectNode jfc, FilterCapabilities fc) {
  ObjectNode sfc = jfc.objectNode();
  // FIXME scalar filter capabilities
  if (sfc.size() > 0) {
    jfc.put(SCALAR, sfc);
  }
}

代码示例来源:origin: com.fasterxml.jackson.core/com.springsource.com.fasterxml.jackson.core.jackson-databind

/**
 * Method that will construct an ObjectNode and add it as a
 * field of this ObjectNode, replacing old value, if any.
 *
 * @return Newly constructed ObjectNode (NOT the old value,
 *   which could be of any type)
 */
public ObjectNode putObject(String fieldName)
{
  ObjectNode n  = objectNode();
  _put(fieldName, n);
  return n;
}

代码示例来源:origin: com.reprezen.genflow/genflow-api

private static JsonNode deepCopyObject(ObjectNode node, IdentityHashMap<JsonNode, JsonNode> copies) {
  ObjectNode copy = node.objectNode();
  copies.put(node, copy);
  for (Entry<String, JsonNode> field : iterable(node.fields())) {
    copy.set(field.getKey(), deepCopy(field.getValue(), copies));
  }
  return copy;
}

代码示例来源:origin: io.digdag/digdag-standards

public static ObjectNode resolveSecrets(ObjectNode node, SecretProvider secrets)
{
  ObjectNode newNode = node.objectNode();
  node.fields().forEachRemaining(entry -> newNode.set(
      UserSecretTemplate.of(entry.getKey()).format(secrets),
      resolveSecrets(entry.getValue(), secrets)));
  return newNode;
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-t2flow

private void makeRange(SpreadsheetRange range, ObjectNode rangeJson) {
    rangeJson.put("start", range.getStart().longValue());
    rangeJson.put("end", range.getEnd().longValue());
    
    ArrayNode excludes = rangeJson.arrayNode();
    for (SpreadsheetRange excludesRange : range.getExcludes().getExclude()) {
      ObjectNode exclude = rangeJson.objectNode();
      makeRange(excludesRange, exclude);
      excludes.add(exclude);
    }
    if (excludes.size() > 0)
      rangeJson.put("excludes", excludes);
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/coding-json

private void encodeSpatialCapabilities(ObjectNode jfc, FilterCapabilities fc) {
  ObjectNode sfc = jfc.objectNode();
  encodeSpatialOperands(fc, sfc);
  encodeSpatialOperators(fc, sfc);
  if (sfc.size() > 0) {
    jfc.put(SPATIAL, sfc);
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/coding-json

private void encodeTemporalCapabilities(ObjectNode jfc, FilterCapabilities fc) {
  ObjectNode tfc = jfc.objectNode();
  encodeTemporalOperands(fc, tfc);
  encodeTemporalOperators(fc, tfc);
  if (tfc.size() > 0) {
    jfc.put(TEMPORAL, tfc);
  }
}

代码示例来源:origin: com.reprezen.genflow/genflow-api

private void addToTree(ObjectNode tree, JsonNode object, ObjectType sectionType, String objectName) {
  if (sectionType.getFromNode(tree, modelVersion).isMissingNode()) {
    sectionType.setInNode(tree, tree.objectNode(), modelVersion);
  }
  ObjectNode section = (ObjectNode) sectionType.getFromNode(tree, modelVersion);
  section.set(objectName, object);
}

相关文章

微信公众号

最新文章

更多