Use singleton NodeIdentifierWithPredicates 66/85366/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 24 Oct 2019 09:38:23 +0000 (11:38 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 24 Oct 2019 09:38:23 +0000 (11:38 +0200)
NodeIdentifierWithPredicates has a specialized single-entry class,
rendering SharedSingletonMap(Template) use unnecessary, which is
flag as a warning. Use the singleton constructor directly.

Change-Id: Ib16348192040d4e4f9d135e792880d8519cad4d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnersModel.java

index a32c8b5..73be124 100644 (file)
@@ -13,7 +13,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.clustering.entity.owners.rev150804.entity.owners.EntityType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.clustering.entity.owners.rev150804.entity.owners.entity.type.Entity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.clustering.entity.owners.rev150804.entity.owners.entity.type.entity.Candidate;
-import org.opendaylight.yangtools.util.SharedSingletonMapTemplate;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
@@ -49,9 +48,6 @@ public final class EntityOwnersModel {
     static final YangInstanceIdentifier ENTITY_OWNERS_PATH = YangInstanceIdentifier.create(ENTITY_OWNERS_NODE_ID);
     static final YangInstanceIdentifier ENTITY_TYPES_PATH = ENTITY_OWNERS_PATH.node(EntityType.QNAME).toOptimized();
 
-    private static final SharedSingletonMapTemplate<QName> NODE_KEY_TEMPLATE = SharedSingletonMapTemplate.ordered(
-        CANDIDATE_NAME_QNAME);
-
     private EntityOwnersModel() {
     }
 
@@ -76,7 +72,7 @@ public final class EntityOwnersModel {
     }
 
     static NodeIdentifierWithPredicates candidateNodeKey(final String candidateName) {
-        return NodeIdentifierWithPredicates.of(Candidate.QNAME, NODE_KEY_TEMPLATE.instantiateWithValue(candidateName));
+        return NodeIdentifierWithPredicates.of(Candidate.QNAME, CANDIDATE_NAME_QNAME, candidateName);
     }
 
     static NormalizedNode<?, ?> entityOwnersWithCandidate(final String entityType,

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.