本文整理了Java中com.fasterxml.jackson.databind.node.ObjectNode.isObject()
方法的一些代码示例,展示了ObjectNode.isObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.isObject()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.node.ObjectNode
类名称:ObjectNode
方法名:isObject
暂无
代码示例来源:origin: org.onosproject/onos-incubator-api
@Override
public ProtocolStatInfo decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
log.debug("name={}, full json={} ", json.get("name"), json);
final String name = json.get("name").asText();
final String breed = json.get("breed").asText();
final long packets = json.get("packets").asLong();
final long bytes = json.get("bytes").asLong();
final int flows = json.get("flows").asInt();
return new ProtocolStatInfo(name, breed, packets, bytes, flows);
}
}
代码示例来源:origin: com.github.cafdataprocessing/corepolicy-common
private static Sort create(ObjectNode node) {
try {
// ensure our jsonnode is an object - and doesn't have multiple children at this stage!
if (!node.isObject())
throw new RuntimeException("Node specified is not an object");
// Copy all the fields onto our Filter node.
Sort sort = new Sort();
sort.setAll(node);
return sort;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
代码示例来源:origin: org.onosproject/onos-core-common
@Override
public ApplicationId decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse application identifier
int id = nullIsIllegal(json.get(APP_ID), APP_ID + MISSING_MEMBER_MESSAGE).asInt();
// parse application name
String name = nullIsIllegal(json.get(APP_NAME), APP_NAME + MISSING_MEMBER_MESSAGE).asText();
return new DefaultApplicationId(id, name);
}
}
代码示例来源:origin: com.github.cafdataprocessing/corepolicy-common
public static Filter create( ObjectNode node ) {
try {
// ensure our jsonnode is an object - and doesnt' have multiple children at this stage!
if (!node.isObject())
throw new RuntimeException("Node specified is not an object");
// Copy all the fields onto our Filter node.
Filter filter = new Filter();
filter.putAll(node);
return filter;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
代码示例来源:origin: org.onosproject/onos-drivers
@Override
public NiciraSetNshSi decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse service index port
short serviceIndexShort = (short) nullIsIllegal(json.get(NSH_SERVICE_INDEX),
NSH_SERVICE_INDEX + MISSING_MEMBER_MESSAGE).asInt();
NshServiceIndex index = NshServiceIndex.of(serviceIndexShort);
return new NiciraSetNshSi(index);
}
}
代码示例来源:origin: org.onosproject/onos-drivers
@Override
public NiciraMatchNshSi decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse nsh service index
short nshSiShort = (short) nullIsIllegal(json.get(NSH_SERVICE_INDEX),
NSH_SERVICE_INDEX + MISSING_MEMBER_MESSAGE).asInt();
NshServiceIndex nshSi = NshServiceIndex.of(nshSiShort);
return new NiciraMatchNshSi(nshSi);
}
}
代码示例来源:origin: org.onosproject/onos-core-common
@Override
public TenantId decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
TenantId tenantId = TenantId.tenantId(extractMember(TENANT_ID, json));
return tenantId;
}
代码示例来源:origin: org.onosproject/onos-drivers
@Override
public NiciraMatchNshSpi decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse nsh path id
int nshSpiInt = nullIsIllegal(json.get(NSH_PATH_ID),
NSH_PATH_ID + MISSING_MEMBER_MESSAGE).asInt();
NshServicePathId nshSpi = NshServicePathId.of(nshSpiInt);
return new NiciraMatchNshSpi(nshSpi);
}
}
代码示例来源:origin: org.onosproject/onos-drivers
@Override
public OfdpaMatchVlanVid decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse ofdpa match vlan vid
short vlanVid = (short) nullIsIllegal(json.get(VLAN_ID),
VLAN_ID + MISSING_MEMBER_MESSAGE).asInt();
return new OfdpaMatchVlanVid(VlanId.vlanId(vlanVid));
}
}
代码示例来源:origin: org.onosproject/onos-core-common
@Override
public Instruction decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
return new DecodeInstructionCodecHelper(json, context).decode();
}
}
代码示例来源:origin: org.onosproject/onos-drivers
@Override
public NiciraSetNshSpi decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse service path id
int servicePathIdInt = nullIsIllegal(json.get(NSH_PATH_ID),
NSH_PATH_ID + MISSING_MEMBER_MESSAGE).asInt();
NshServicePathId pathId = NshServicePathId.of(servicePathIdInt);
return new NiciraSetNshSpi(pathId);
}
}
代码示例来源:origin: org.onosproject/onos-drivers
@Override
public NiciraResubmit decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse in port number
long portNumberLong = nullIsIllegal(json.get(RESUBMIT_PORT), RESUBMIT_PORT + MISSING_MEMBER_MESSAGE).asLong();
PortNumber portNumber = PortNumber.portNumber(portNumberLong);
return new NiciraResubmit(portNumber);
}
}
代码示例来源:origin: org.onosproject/onos-drivers
@Override
public NiciraSetTunnelDst decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse tunnel destination IP address
String dstIp = nullIsIllegal(json.get(TUNNEL_DST), TUNNEL_DST + MISSING_MEMBER_MESSAGE).asText();
Ip4Address tunnelDst = Ip4Address.valueOf(dstIp);
return new NiciraSetTunnelDst(tunnelDst);
}
}
代码示例来源:origin: org.onosproject/onos-drivers
@Override
public OfdpaSetVlanVid decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse ofdpa set vlan vid
short vlanVid = (short) nullIsIllegal(json.get(VLAN_ID),
VLAN_ID + MISSING_MEMBER_MESSAGE).asInt();
return new OfdpaSetVlanVid(VlanId.vlanId(vlanVid));
}
}
代码示例来源:origin: org.onosproject/onos-core-common
@Override
public MastershipTerm decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// node identifier of master
NodeId nodeId = NodeId.nodeId(nullIsIllegal(json.get(MASTER),
MASTER + MISSING_MEMBER_MESSAGE).asText());
// term number
long termNumber = nullIsIllegal(json.get(TERM_NUMBER),
TERM_NUMBER + MISSING_MEMBER_MESSAGE).asLong();
return MastershipTerm.of(nodeId, termNumber);
}
}
代码示例来源:origin: apache/streams
protected StringBuilder appendRootObject(StringBuilder builder, Schema schema, String resourceId, Character seperator) {
ObjectNode propertiesNode = schemaStore.resolveProperties(schema, null, resourceId);
if ( propertiesNode.get("id") != null ) {
builder.append("id text PRIMARY KEY,");
builder.append(LS);
propertiesNode.remove("id");
}
if ( propertiesNode.isObject() && propertiesNode.size() > 0) {
builder = appendPropertiesNode(builder, schema, propertiesNode, seperator);
}
return builder;
}
代码示例来源:origin: apache/streams
protected StringBuilder appendRootObject(StringBuilder builder, Schema schema, String resourceId, Character seperator) {
ObjectNode propertiesNode = schemaStore.resolveProperties(schema, null, resourceId);
if ( propertiesNode.get("id") != null ) {
builder.append("id text PRIMARY KEY,");
builder.append(LS);
propertiesNode.remove("id");
}
if ( propertiesNode != null && propertiesNode.isObject() && propertiesNode.size() > 0) {
builder = appendPropertiesNode(builder, schema, propertiesNode, seperator);
}
return builder;
}
代码示例来源:origin: apache/streams
protected StringBuilder appendRootObject(StringBuilder builder, Schema schema, String resourceId, Character seperator) {
ObjectNode propertiesNode = schemaStore.resolveProperties(schema, null, resourceId);
if ( propertiesNode != null && propertiesNode.isObject() && propertiesNode.size() > 0) {
builder = appendPropertiesNode(builder, schema, propertiesNode, seperator);
}
return builder;
}
代码示例来源:origin: apache/streams
protected StringBuilder appendRootObject(StringBuilder builder, Schema schema, String resourceId, Character separator) {
ObjectNode propertiesNode = schemaStore.resolveProperties(schema, null, resourceId);
if (propertiesNode != null && propertiesNode.isObject() && propertiesNode.size() > 0) {
builder = appendPropertiesNode(builder, schema, propertiesNode, separator);
}
return builder;
}
代码示例来源:origin: org.onosproject/onos-core-common
@Override
public McastRoute decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
IpAddress source = IpAddress.valueOf(json.path(SOURCE).asText());
IpAddress group = IpAddress.valueOf(json.path(GROUP).asText());
McastRoute route = new McastRoute(source, group, McastRoute.Type.STATIC);
return route;
}
}
内容来源于网络,如有侵权,请联系作者删除!