当前位置: 首页>>代码示例>>Java>>正文


Java ObjectNode.isObject方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.databind.node.ObjectNode.isObject方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectNode.isObject方法的具体用法?Java ObjectNode.isObject怎么用?Java ObjectNode.isObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.databind.node.ObjectNode的用法示例。


在下文中一共展示了ObjectNode.isObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * Note: ProviderId is not part of JSON representation.
 *       Returned object will have random ProviderId set.
 */
@Override
public Device decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    DeviceId id = deviceId(json.get(ID).asText());
    // TODO: add providerId to JSON if we need to recover them.
    ProviderId pid = new ProviderId(id.uri().getScheme(), "DeviceCodec");

    Type type = Type.valueOf(json.get(TYPE).asText());
    String mfr = json.get(MFR).asText();
    String hw = json.get(HW).asText();
    String sw = json.get(SW).asText();
    String serial = json.get(SERIAL).asText();
    ChassisId chassisId = new ChassisId(json.get(CHASSIS_ID).asText());
    Annotations annotations = extractAnnotations(json, context);

    return new DefaultDevice(pid, id, type, mfr, hw, sw, serial,
                             chassisId, annotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:DeviceCodec.java

示例2: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public NiciraSetNshContextHeader decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    // parse nsh context header
    int contextHeaderInt = nullIsIllegal(json.get(NSH_CONTEXT_HEADER),
            NSH_CONTEXT_HEADER + MISSING_MEMBER_MESSAGE).asInt();

    NshContextHeader contextHeader = NshContextHeader.of(contextHeaderInt);

    // parse type
    int extensionTypeInt = nullIsIllegal(json.get(TYPE),
            TYPE + MISSING_MEMBER_MESSAGE).asInt();

    ExtensionTreatmentType type = new ExtensionTreatmentType(extensionTypeInt);

    return new NiciraSetNshContextHeader(contextHeader, type);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:NiciraSetNshContextHeaderCodec.java

示例3: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public NiciraResubmitTable 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);

    // parse table id
    short tableId = (short) nullIsIllegal(json.get(RESUBMIT_TABLE),
            RESUBMIT_TABLE + MISSING_MEMBER_MESSAGE).asInt();

    return new NiciraResubmitTable(portNumber, tableId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:NiciraResubmitTableCodec.java

示例4: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public RoleInfo decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    // parse node identifier of master
    NodeId nodeId = json.get(MASTER) == null ?
            null : NodeId.nodeId(json.get(MASTER).asText());

    // parse node identifier of backups
    List<NodeId> backups = new ArrayList<>();

    ArrayNode backupsJson = (ArrayNode) nullIsIllegal(json.get(BACKUPS),
            BACKUPS + MISSING_MEMBER_MESSAGE);

    IntStream.range(0, backupsJson.size()).forEach(i -> {
        JsonNode backupJson = nullIsIllegal(backupsJson.get(i),
                "Backup node id cannot be null");
        backups.add(NodeId.nodeId(backupJson.asText()));
    });

    return new RoleInfo(nodeId, backups);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:RoleInfoCodec.java

示例5: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:MastershipTermCodec.java

示例6: decodeExtension

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public ExtFlowTypes decodeExtension(ObjectNode json) {
    if (json == null || !json.isObject()) {
        return null;
    }

    ExtIcmpCode.Builder resultBuilder = new DefaultExtIcmpCode.Builder();

    String icmpCode = nullIsIllegal(json.get(BgpFlowExtensionCodec.ICMP_CODE),
            BgpFlowExtensionCodec.ICMP_CODE + MISSING_MEMBER_MESSAGE).asText();
    resultBuilder.setIcmpCode(parse.parseIcmpCode(icmpCode));
    resultBuilder.setType(ExtFlowTypes.ExtType.ICMP_CODE_LIST);

    return resultBuilder.build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:DecodeBgpFlowExtnCodecHelper.java

示例7: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public Band decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    // parse rate
    long rate = nullIsIllegal(json.get(RATE), RATE + MISSING_MEMBER_MESSAGE).asLong();

    // parse burst size
    long burstSize = nullIsIllegal(json.get(BURST_SIZE), BURST_SIZE + MISSING_MEMBER_MESSAGE).asLong();

    // parse precedence
    Short precedence = null;

    // parse band type
    String typeStr = nullIsIllegal(json.get(TYPE), TYPE + MISSING_MEMBER_MESSAGE).asText();
    Band.Type type;
    switch (typeStr) {
        case "DROP":
            type = Band.Type.DROP;
            break;
        case "REMARK":
            type = Band.Type.REMARK;
            precedence = (short) nullIsIllegal(json.get(PREC), PREC + MISSING_MEMBER_MESSAGE).asInt();
            break;
        default:
            log.warn("The requested type {} is not defined for band.", typeStr);
            return null;
    }

    Band band = DefaultBand.builder()
            .ofType(type)
            .burstSize(burstSize)
            .withRate(rate)
            .dropPrecedence(precedence)
            .build();

    return band;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:MeterBandCodec.java

示例8: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:NiciraSetNshSpiCodec.java

示例9: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:NiciraResubmitCodec.java

示例10: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:NiciraMatchNshSpiCodec.java

示例11: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public PortPair decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    PortPair.Builder resultBuilder = new DefaultPortPair.Builder();

    CoreService coreService = context.getService(CoreService.class);

    String id = nullIsIllegal(json.get(ID),
                              ID + MISSING_MEMBER_MESSAGE).asText();
    resultBuilder.setId(PortPairId.of(id));

    String tenantId = nullIsIllegal(json.get(TENANT_ID),
                                    TENANT_ID + MISSING_MEMBER_MESSAGE).asText();
    resultBuilder.setTenantId(TenantId.tenantId(tenantId));

    String name = nullIsIllegal(json.get(NAME),
                                NAME + MISSING_MEMBER_MESSAGE).asText();
    resultBuilder.setName(name);

    String description = nullIsIllegal(json.get(DESCRIPTION),
                                       DESCRIPTION + MISSING_MEMBER_MESSAGE).asText();
    resultBuilder.setDescription(description);

    String ingressPort = nullIsIllegal(json.get(INGRESS),
                                       INGRESS + MISSING_MEMBER_MESSAGE).asText();
    resultBuilder.setIngress(ingressPort);

    String egressPort = nullIsIllegal(json.get(EGRESS),
                                      EGRESS + MISSING_MEMBER_MESSAGE).asText();
    resultBuilder.setEgress(egressPort);

    return resultBuilder.build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:PortPairCodec.java

示例12: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public VirtualDevice decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    DeviceId dId = DeviceId.deviceId(extractMember(ID, json));
    NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
    return new DefaultVirtualDevice(nId, dId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:VirtualDeviceCodec.java

示例13: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@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;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:McastRouteCodec.java

示例14: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public VirtualNetwork decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
    TenantId tId = TenantId.tenantId(extractMember(TENANT_ID, json));
    return new DefaultVirtualNetwork(nId, tId);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:VirtualNetworkCodec.java

示例15: decode

import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Override
public PcePath decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        log.error("Empty json input");
        return null;
    }

    // build pce-path
    PcePath.Builder resultBuilder = new DefaultPcePath.Builder();

    // retrieve source
    JsonNode jNode = json.get(SOURCE);
    if (jNode != null) {
        String src = jNode.asText();
        resultBuilder.source(src);
    }

    // retrieve destination
    jNode = json.get(DESTINATION);
    if (jNode != null) {
        String dst = jNode.asText();
        resultBuilder.destination(dst);
    }

    // retrieve lsp-type
    jNode = json.get(LSP_TYPE);
    if (jNode != null) {
        String lspType = jNode.asText();
        resultBuilder.lspType(lspType);
    }

    // retrieve symbolic-path-name
    jNode = json.get(SYMBOLIC_PATH_NAME);
    if (jNode != null) {
        String name = jNode.asText();
        resultBuilder.name(name);
    }

    // retrieve constraint
    JsonNode constraintJNode = (JsonNode) json.path(CONSTRAINT);
    if ((constraintJNode != null) && (!constraintJNode.isMissingNode())) {
        // retrieve cost
        jNode = constraintJNode.get(COST);
        if (jNode != null) {
            String cost = jNode.asText();
            resultBuilder.costConstraint(cost);
        }

        // retrieve bandwidth
        jNode = constraintJNode.get(BANDWIDTH);
        if (jNode != null) {
            String bandwidth = jNode.asText();
            resultBuilder.bandwidthConstraint(bandwidth);
        }
    }

    return resultBuilder.build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:59,代码来源:PcePathCodec.java


注:本文中的com.fasterxml.jackson.databind.node.ObjectNode.isObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。