本文整理了Java中org.codehaus.jackson.node.ObjectNode.arrayNode()
方法的一些代码示例,展示了ObjectNode.arrayNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.arrayNode()
方法的具体详情如下:
包路径:org.codehaus.jackson.node.ObjectNode
类名称:ObjectNode
方法名:arrayNode
暂无
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl
/**
* 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: camunda/camunda-bpm-platform
/**
* 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: org.codehaus.jackson/jackson-mapper-lgpl
/**
* 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: com.barchart.wrap/barchart-wrap-jackson
/**
* 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: ovea-deprecated/jetty-session-redis
/**
* 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: inspectIT/inspectIT
@Test
public void testIDAssignment() throws JsonProcessingException, IOException {
ObjectNode beacon = new ObjectNode(JsonNodeFactory.instance);
beacon.put("sessionID", "" + Long.toString(Beacon.REQUEST_NEW_SESSION_ID_MARKER, 16));
beacon.put("tabID", "" + Long.toString(Beacon.REQUEST_NEW_TAB_ID_MARKER, 16));
beacon.put("activeAgentModules", MODULES_DEMOVALUE);
ArrayNode data = beacon.arrayNode();
beacon.put("data", data);
String beaconJson = beacon.toString();
String responseJson = dataHandler.insertBeacon(beaconJson);
Mockito.verify(coreService, Mockito.times(0)).addDefaultData(any(DefaultData.class));
JsonNode response = (new ObjectMapper()).readTree(responseJson);
assertThat(response, instanceOf(ObjectNode.class));
assertThat(response.get("sessionID").asText(), notNullValue());
assertThat(response.get("tabID").asText(), notNullValue());
}
代码示例来源:origin: com.moz.fiji.schema/fiji-schema
/** {@inheritDoc} */
@Override
protected JsonNode toJsonNode() {
final ObjectNode root = JsonNodeFactory.instance.objectNode();
root.put(OPERATOR_NODE, mOperator.name());
final ArrayNode filters = root.arrayNode();
for (FijiRowFilter filter : mFilters) {
if (filter != null) {
filters.add(filter.toJson());
}
}
root.put(FILTERS_NODE, filters);
return root;
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void testSessionInfoSending() {
ObjectNode beacon = new ObjectNode(JsonNodeFactory.instance);
ObjectNode sessInfo = new ObjectNode(JsonNodeFactory.instance);
sessInfo.put("type", "metaInfo");
sessInfo.put("browser", "Firefox");
sessInfo.put("device", "iOS");
sessInfo.put("language", "de");
beacon.put("sessionID", "" + Long.toString(SESSID_DEMOVALUE, 16));
beacon.put("tabID", "" + Long.toString(TABID_DEMOVALUE, 16));
beacon.put("activeAgentModules", MODULES_DEMOVALUE);
ArrayNode data = beacon.arrayNode();
beacon.put("data", data);
data.add(sessInfo);
String beaconJson = beacon.toString();
dataHandler.insertBeacon(beaconJson);
Mockito.verify(coreService, Mockito.times(1)).addDefaultData(any(DefaultData.class));
List<DefaultData> sent = sentElements.getAllValues();
assertThat(sent.size(), equalTo(1));
assertThat(sent.get(0), instanceOf(UserSessionInfo.class));
UserSessionInfo sentInfo = (UserSessionInfo) sent.get(0);
assertThat(sentInfo.getBrowser(), equalTo("Firefox"));
assertThat(sentInfo.getDevice(), equalTo("iOS"));
assertThat(sentInfo.getLanguage(), equalTo("de"));
assertThat(sentInfo.getSessionId(), equalTo(SESSID_DEMOVALUE));
}
代码示例来源:origin: de.mhus.lib/mhu-lib-core
ArrayNode array = to.arrayNode();
to.put(name, array);
for (Object o : (Object[])value) {
ArrayNode array = to.arrayNode();
to.put(name, array);
for (Object o : ((Collection<Object>)value)) {
代码示例来源:origin: de.mhus.lib/mhu-lib-core
ArrayNode array = to.arrayNode();
to.put("array", array);
for (Object i : (Object[])from) {
ArrayNode array = to.arrayNode();
to.put("_collection", array);
for (Object o : obj) {
else
if (value instanceof String[]) {
ArrayNode array = to.arrayNode();
to.put(name, array);
for (String i : (String[])value)
} else
if (value instanceof Object[]) {
ArrayNode array = to.arrayNode();
to.put(name, array);
for (Object i : (Object[])value) {
if (value instanceof Collection) {
Collection<?> obj = (Collection<?>)value;
ArrayNode array = to.arrayNode();
to.put(name, array);
for (Object o : obj) {
代码示例来源:origin: de.mhus.lib/mhu-lib-core
ArrayNode array = node.arrayNode();
node.put(name, array);
setValues(array, (Object[])value, level);
ArrayNode array = node.arrayNode();
node.put(name, array);
setValues(array, (Collection<?>)value, level);
代码示例来源:origin: inspectIT/inspectIT
@Test
public void testInvalidBeaconContent() {
ObjectNode beacon = new ObjectNode(JsonNodeFactory.instance);
ObjectNode sessInfo = new ObjectNode(JsonNodeFactory.instance);
sessInfo.put("type", "unkownType");
sessInfo.put("browser", "Firefox");
sessInfo.put("device", "iOS");
sessInfo.put("language", "de");
beacon.put("sessionID", "" + Long.toString(SESSID_DEMOVALUE, 16));
beacon.put("tabID", "" + Long.toString(TABID_DEMOVALUE, 16));
beacon.put("activeAgentModules", MODULES_DEMOVALUE);
ArrayNode data = beacon.arrayNode();
beacon.put("data", data);
data.add(sessInfo);
String beaconJson = beacon.toString();
dataHandler.insertBeacon(beaconJson);
Mockito.verify(coreService, Mockito.times(0)).addDefaultData(any(DefaultData.class));
}
}
代码示例来源:origin: de.mhus.lib/mhu-lib-core
@Override
public WritableResourceNode<IConfig> createConfig(String key) throws MException {
// find array node, to append new config
if (node.get(key) != null && !node.get(key).isArray()) {
node.remove(key);
}
ArrayNode array = (ArrayNode) node.get(key);
if (array == null) { // if not, create one
array = node.arrayNode();
node.put(key, array);
}
if (! (array instanceof ArrayNode) ) {
throw new MException(key + " is not an array");
}
// create new object node in array
ObjectNode out = array.objectNode();
array.add(out);
return new JsonConfig(key, this, out);
}
内容来源于网络,如有侵权,请联系作者删除!