X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-protocolbuffer-encoding%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2Futils%2FNodeIdentifierWithPredicatesGenerator.java;h=6d3a26ad77fe73889ecfe4ae77a5b6259dcec94a;hp=86430a57b3043efed53153862c573bc0994ddc0d;hb=69eca29208f36b9a02992319cc36d1d221189ff0;hpb=f1c47fb514878ef2149e5f22d6098ff8c79dec1d diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java index 86430a57b3..6d3a26ad77 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java @@ -1,7 +1,17 @@ +/* + * + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + package org.opendaylight.controller.cluster.datastore.node.utils; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; @@ -19,15 +29,16 @@ public class NodeIdentifierWithPredicatesGenerator{ private final boolean doesMatch; private final ListSchemaNode listSchemaNode; - public NodeIdentifierWithPredicatesGenerator(String id){ - this(id, null); - } - - public NodeIdentifierWithPredicatesGenerator(String id, ListSchemaNode schemaNode){ + public NodeIdentifierWithPredicatesGenerator(String id, DataSchemaNode schemaNode){ this.id = id; matcher = pattern.matcher(this.id); doesMatch = matcher.matches(); - this.listSchemaNode = schemaNode; + + if(schemaNode instanceof ListSchemaNode){ + this.listSchemaNode = (ListSchemaNode) schemaNode; + } else { + this.listSchemaNode = null; + } } @@ -35,7 +46,7 @@ public class NodeIdentifierWithPredicatesGenerator{ return doesMatch; } - public InstanceIdentifier.NodeIdentifierWithPredicates getPathArgument(){ + public YangInstanceIdentifier.NodeIdentifierWithPredicates getPathArgument(){ final String group = matcher.group(2); final String[] keyValues = group.split(","); Map nameValues = new HashMap<>(); @@ -52,7 +63,7 @@ public class NodeIdentifierWithPredicatesGenerator{ } } - return new InstanceIdentifier.NodeIdentifierWithPredicates(QNameFactory.create(matcher.group(1)), nameValues); + return new YangInstanceIdentifier.NodeIdentifierWithPredicates(QNameFactory.create(matcher.group(1)), nameValues); }