本文整理了Java中org.codehaus.jackson.node.ObjectNode.putPOJO()
方法的一些代码示例,展示了ObjectNode.putPOJO()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.putPOJO()
方法的具体详情如下:
包路径:org.codehaus.jackson.node.ObjectNode
类名称:ObjectNode
方法名:putPOJO
暂无
代码示例来源:origin: org.apache.curator/curator-x-discovery-server
@Override
public void marshallJson(ObjectNode node, String fieldName, T payload) throws Exception
{
if ( payload == null )
{
//noinspection unchecked
payload = (T)payloadType.getRawType().newInstance();
}
node.putPOJO(fieldName, payload);
}
代码示例来源:origin: Talend/components
public ObjectNode toJSONObject() {
ObjectNode o = mapper.createObjectNode();
for (Map.Entry<String, Object> header : headers.entrySet()) {
o.putPOJO(header.getKey(), header.getValue());
}
return o;
}
代码示例来源:origin: PeterKnego/LeanEngine-Server
private JsonNode toJSON(NativeObject object) {
if (object == null) return null;
ObjectNode result = JsonUtils.getObjectMapper().createObjectNode();
for (Map.Entry<Object, Object> entry : object.entrySet()) {
if (entry.getValue().getClass().equals(NativeObject.class)) {
result.put((String) entry.getKey(), toJSON((NativeObject) entry.getValue()));
} else if (entry.getValue().getClass().equals(NativeArray.class)) {
result.put((String) entry.getKey(), toJSON((NativeArray) entry.getValue()));
} else {
result.putPOJO((String) entry.getKey(), entry.getValue());
}
}
return result;
}
代码示例来源:origin: Talend/components
public JsonNode toJSONObject() {
ObjectNode o = mapper.createObjectNode();
for (Map.Entry<String, Object> claim : claims.entrySet()) {
if (CLAIM_AUDIENCE.equals(claim.getKey())) {
// Serialize single audience list and string
List<String> audList = getAudience();
if (audList != null && !audList.isEmpty()) {
if (audList.size() == 1) {
o.put(CLAIM_AUDIENCE, audList.get(0));
} else {
ArrayNode audArray = mapper.createArrayNode();
for (String aud : audList) {
audArray.add(aud);
}
o.put(CLAIM_AUDIENCE, audArray);
}
}
} else if (claim.getValue() != null) {
o.putPOJO(claim.getKey(), claim.getValue());
}
}
return o;
}
代码示例来源:origin: PeterKnego/LeanEngine-Server
public static JsonNode entityToJson(Entity entity) throws LeanException {
ObjectNode json = getObjectMapper().createObjectNode();
json.put("_id", entity.getKey().getId());
json.putPOJO("_kind", entity.getKind());
json.putPOJO("_account", entity.getProperty("_account"));
Map<String, Object> props = entity.getProperties();
for (Map.Entry<String, Object> prop : props.entrySet()) {
addTypedNode(json, prop.getKey(), prop.getValue());
}
return json;
}
内容来源于网络,如有侵权,请联系作者删除!