本文整理了Java中com.fasterxml.jackson.databind.node.ObjectNode.arrayNode()
方法的一些代码示例,展示了ObjectNode.arrayNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.arrayNode()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.node.ObjectNode
类名称:ObjectNode
方法名:arrayNode
暂无
代码示例来源:origin: redisson/redisson
@Override
public ArrayNode withArray(String propertyName)
{
JsonNode n = _children.get(propertyName);
if (n != null) {
if (n instanceof ArrayNode) {
return (ArrayNode) n;
}
throw new UnsupportedOperationException("Property '" + propertyName
+ "' has value that is not of type ArrayNode (but " + n
.getClass().getName() + ")");
}
ArrayNode result = arrayNode();
_children.put(propertyName, result);
return result;
}
代码示例来源:origin: redisson/redisson
/**
* Method that will construct an ArrayNode 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>ArrayNode</code> instance.
*
* @return Newly constructed ArrayNode (NOT the old value,
* which could be of any type)
*/
public ArrayNode putArray(String fieldName)
{
ArrayNode n = arrayNode();
_put(fieldName, n);
return n;
}
代码示例来源:origin: ethereum/ethereumj
blockNode.put("timestamp", String.valueOf(block.getTimestamp()));
ArrayNode transactionsNode = blockNode.arrayNode();
blockNode.set("transactions", transactionsNode);
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
@Override
public ArrayNode withArray(String propertyName)
{
JsonNode n = _children.get(propertyName);
if (n != null) {
if (n instanceof ArrayNode) {
return (ArrayNode) n;
}
throw new UnsupportedOperationException("Property '" + propertyName
+ "' has value that is not of type ArrayNode (but " + n
.getClass().getName() + ")");
}
ArrayNode result = arrayNode();
_children.put(propertyName, result);
return result;
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
@Override
public ArrayNode withArray(String propertyName)
{
JsonNode n = _children.get(propertyName);
if (n != null) {
if (n instanceof ArrayNode) {
return (ArrayNode) n;
}
throw new UnsupportedOperationException("Property '" + propertyName
+ "' has value that is not of type ArrayNode (but " + n
.getClass().getName() + ")");
}
ArrayNode result = arrayNode();
_children.put(propertyName, result);
return result;
}
代码示例来源:origin: com.sonymobile/lumbermill-core
public JsonEvent add(String field, String... values) {
for (String value : values) {
if (jsonNode.has(field)) {
ArrayNode arrayNode = (ArrayNode) this.jsonNode.get(field);
arrayNode.add(value);
} else {
jsonNode.set(field, jsonNode.arrayNode().add(value));
}
}
return this;
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
@Override
public ArrayNode withArray(String propertyName)
{
JsonNode n = _children.get(propertyName);
if (n != null) {
if (n instanceof ArrayNode) {
return (ArrayNode) n;
}
throw new UnsupportedOperationException("Property '" + propertyName
+ "' has value that is not of type ArrayNode (but " + n
.getClass().getName() + ")");
}
ArrayNode result = arrayNode();
_children.put(propertyName, result);
return result;
}
代码示例来源:origin: Nextdoor/bender
@Override
public ArrayNode withArray(String propertyName)
{
JsonNode n = _children.get(propertyName);
if (n != null) {
if (n instanceof ArrayNode) {
return (ArrayNode) n;
}
throw new UnsupportedOperationException("Property '" + propertyName
+ "' has value that is not of type ArrayNode (but " + n
.getClass().getName() + ")");
}
ArrayNode result = arrayNode();
_children.put(propertyName, result);
return result;
}
代码示例来源:origin: com.fasterxml.jackson.core/com.springsource.com.fasterxml.jackson.core.jackson-databind
/**
* Method that will construct an ArrayNode and add it as a
* field of this ObjectNode, replacing old value, if any.
*
* @return Newly constructed ArrayNode (NOT the old value,
* which could be of any type)
*/
public ArrayNode putArray(String fieldName)
{
ArrayNode n = arrayNode();
_put(fieldName, n);
return n;
}
代码示例来源:origin: Nextdoor/bender
/**
* Method that will construct an ArrayNode 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>ArrayNode</code> instance.
*
* @return Newly constructed ArrayNode (NOT the old value,
* which could be of any type)
*/
public ArrayNode putArray(String fieldName)
{
ArrayNode n = arrayNode();
_put(fieldName, n);
return n;
}
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
/**
* Method that will construct an ArrayNode 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>ArrayNode</code> instance.
*
* @return Newly constructed ArrayNode (NOT the old value,
* which could be of any type)
*/
public ArrayNode putArray(String fieldName)
{
ArrayNode n = arrayNode();
_put(fieldName, n);
return n;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Method that will construct an ArrayNode 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>ArrayNode</code> instance.
*
* @return Newly constructed ArrayNode (NOT the old value,
* which could be of any type)
*/
public ArrayNode putArray(String fieldName)
{
ArrayNode n = arrayNode();
_put(fieldName, n);
return n;
}
代码示例来源:origin: usdot-jpo-ode/jpo-ode
private static ArrayNode transformLaneDataAttributeList(JsonNode laneDataAttribute) {
ArrayNode updatedLaneDataAttributeList = JsonUtils.newNode().arrayNode();
if (laneDataAttribute.isArray()) {
Iterator<JsonNode> laneDataAttributeListIter = laneDataAttribute.elements();
while (laneDataAttributeListIter.hasNext()) {
JsonNode oldNode = laneDataAttributeListIter.next();
replaceLaneDataAttribute(oldNode);
updatedLaneDataAttributeList.add(oldNode);
}
}
return updatedLaneDataAttributeList;
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Method that will construct an ArrayNode 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>ArrayNode</code> instance.
*
* @return Newly constructed ArrayNode (NOT the old value,
* which could be of any type)
*/
public ArrayNode putArray(String fieldName)
{
ArrayNode n = arrayNode();
_put(fieldName, n);
return n;
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Method that will construct an ArrayNode 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>ArrayNode</code> instance.
*
* @return Newly constructed ArrayNode (NOT the old value,
* which could be of any type)
*/
public ArrayNode putArray(String fieldName)
{
ArrayNode n = arrayNode();
_put(fieldName, n);
return n;
}
代码示例来源:origin: usdot-jpo-ode/jpo-ode
public static ObjectNode transformRegions(JsonNode regions) throws JsonUtilsException {
ArrayNode replacedRegions = JsonUtils.newNode().arrayNode();
if (regions.isArray()) {
Iterator<JsonNode> regionsIter = regions.elements();
while (regionsIter.hasNext()) {
JsonNode curRegion = regionsIter.next();
replaceRegion((ObjectNode) curRegion);
replacedRegions.add(curRegion);
}
}
return JsonUtils.newObjectNode(GEOGRAPHICAL_PATH_STRING, replacedRegions);
}
代码示例来源: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/profile-coding
private void writeDefaultObservationTypesForEncoding(Profile profile, ObjectNode objectNode) {
if (profile.isSetDefaultObservationTypesForEncoding()) {
ObjectNode node = objectNode.putObject(DEFAULT_OBS_TYPE_FOR_ENCODING);
if (profile.getDefaultObservationTypesForEncoding().size() == 1) {
for (Entry<String, String> entry : profile.getDefaultObservationTypesForEncoding().entrySet()) {
node.put(NAMESPACE, entry.getKey());
node.put(OBS_TYPE, entry.getValue());
}
} else {
ArrayNode arrayNode = node.arrayNode();
for (Entry<String, String> entry : profile.getDefaultObservationTypesForEncoding().entrySet()) {
ObjectNode addObject = arrayNode.addObject();
addObject.put(NAMESPACE, entry.getKey());
addObject.put(OBS_TYPE, entry.getValue());
}
}
}
}
代码示例来源:origin: org.apache.taverna.commonactivities/taverna-spreadsheet-import-activity
/**
* Test method for {@link net.sf.taverna.t2.activities.spreadsheet.SpreadsheetUtils#getPortName(java.lang.String, java.util.Map)}.
*/
@Test
public void testGetPortNameStringMapOfStringString() {
assertEquals("A", SpreadsheetUtils.getPortName("A", null));
assertEquals("AABR", SpreadsheetUtils.getPortName("AABR", null));
ObjectNode configuration = JsonNodeFactory.instance.objectNode();
ArrayNode columnNames = configuration.arrayNode();
columnNames.addObject().put("column", "B").put("port", "beta");
configuration.put("columnNames", columnNames);
assertEquals("beta", SpreadsheetUtils.getPortName("B", configuration));
assertEquals("T", SpreadsheetUtils.getPortName("T", configuration));
}
代码示例来源:origin: org.apache.taverna.commonactivities/taverna-spreadsheet-import-activity
/**
* Test method for {@link net.sf.taverna.t2.activities.spreadsheet.SpreadsheetUtils#getPortName(int, java.util.Map)}.
*/
@Test
public void testGetPortNameIntMapOfStringString() {
assertEquals("A", SpreadsheetUtils.getPortName(0, null));
assertEquals("AA", SpreadsheetUtils.getPortName(26, null));
ObjectNode configuration = JsonNodeFactory.instance.objectNode();
ArrayNode columnNames = configuration.arrayNode();
columnNames.addObject().put("column", "D").put("port", "delta");
configuration.put("columnNames", columnNames);
assertEquals("delta", SpreadsheetUtils.getPortName(3, configuration));
assertEquals("AB", SpreadsheetUtils.getPortName(27, configuration));
}
内容来源于网络,如有侵权,请联系作者删除!