Disconnect yang-datae-tree-ri from concepts.Builder 46/99346/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Jan 2022 07:23:48 +0000 (08:23 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Jan 2022 07:24:31 +0000 (08:24 +0100)
concepts.Builder is going away, do not rely on it for our internal
classes.

JIRA: YANGTOOLS-1328
Change-Id: Idc02cfdb4b62a8d4444263b48ab30459bcd21de1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
data/yang-data-tree-ri/src/main/java/module-info.java
data/yang-data-tree-ri/src/main/java/org/opendaylight/yangtools/yang/data/tree/leafref/LeafRefContextBuilder.java
data/yang-data-tree-ri/src/main/java/org/opendaylight/yangtools/yang/data/tree/leafref/QNameWithPredicate.java
data/yang-data-tree-ri/src/main/java/org/opendaylight/yangtools/yang/data/tree/leafref/QNameWithPredicateBuilder.java

index f12244cf472af0bfb21822f9e417d165069961c4..532577533a73023f5bf76de1d2f401eb8913b9ab 100644 (file)
@@ -15,6 +15,7 @@ module org.opendaylight.yangtools.yang.data.tree {
     provides DataTreeFactory with InMemoryDataTreeFactory;
 
     requires transitive org.opendaylight.yangtools.yang.data.tree.api;
+    requires org.opendaylight.yangtools.concepts;
     requires org.opendaylight.yangtools.yang.data.tree.spi;
     requires org.opendaylight.yangtools.yang.data.impl;
     requires org.opendaylight.yangtools.yang.data.spi;
index 06aada4fc2e55614aeb59b583770986752b2f50a..0ef444f95fac5027acfc45748d3a532d38d3014b 100644 (file)
@@ -12,15 +12,15 @@ import static java.util.Objects.requireNonNull;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import org.opendaylight.yangtools.concepts.Builder;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.concepts.Mutable;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
-final class LeafRefContextBuilder implements Builder<LeafRefContext> {
-
+final class LeafRefContextBuilder implements Mutable {
     private final Map<QName, LeafRefContext> referencingChildren = new HashMap<>();
     private final Map<QName, LeafRefContext> referencedByChildren = new HashMap<>();
     private final Map<QName, LeafRefContext> referencedByLeafRefCtx = new HashMap<>();
@@ -43,8 +43,7 @@ final class LeafRefContextBuilder implements Builder<LeafRefContext> {
         this.schemaContext = requireNonNull(schemaContext);
     }
 
-    @Override
-    public LeafRefContext build() {
+    @NonNull LeafRefContext build() {
         final LeafRefContext leafRefContext = new LeafRefContext(this);
 
         // LeafRefContext has made a copy of these
@@ -60,7 +59,7 @@ final class LeafRefContextBuilder implements Builder<LeafRefContext> {
     }
 
     void setReferencedBy(final boolean referencedBy) {
-        this.isReferencedBy = referencedBy;
+        isReferencedBy = referencedBy;
     }
 
     boolean isReferencing() {
@@ -68,7 +67,7 @@ final class LeafRefContextBuilder implements Builder<LeafRefContext> {
     }
 
     void setReferencing(final boolean referencing) {
-        this.isReferencing = referencing;
+        isReferencing = referencing;
     }
 
     void addReferencingChild(final LeafRefContext child, final QName childQName) {
@@ -96,7 +95,7 @@ final class LeafRefContextBuilder implements Builder<LeafRefContext> {
     }
 
     void setLeafRefTargetPath(final LeafRefPath leafRefPath) {
-        this.leafRefTargetPath = requireNonNull(leafRefPath);
+        leafRefTargetPath = requireNonNull(leafRefPath);
     }
 
     String getLeafRefTargetPathString() {
@@ -104,7 +103,7 @@ final class LeafRefContextBuilder implements Builder<LeafRefContext> {
     }
 
     void setLeafRefTargetPathString(final String leafRefPathString) {
-        this.leafRefTargetPathString = requireNonNull(leafRefPathString);
+        leafRefTargetPathString = requireNonNull(leafRefPathString);
     }
 
     QName getCurrentNodeQName() {
index bd43f0ecc7c16727d772f2c0522f2fec5d018bfd..1e099853ba31ae14a828de7c80ba122506051ae6 100644 (file)
@@ -8,14 +8,15 @@
 package org.opendaylight.yangtools.yang.data.tree.leafref;
 
 import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 
 public interface QNameWithPredicate {
 
-    QNameWithPredicate UP_PARENT = new QNameWithPredicateBuilder(null, "..").build();
+    @NonNull QNameWithPredicate UP_PARENT = new QNameWithPredicateBuilder(null, "..").build();
 
-    QNameWithPredicate ROOT = new QNameWithPredicateBuilder(null, "").build();
+    @NonNull QNameWithPredicate ROOT = new QNameWithPredicateBuilder(null, "").build();
 
     List<QNamePredicate> getQNamePredicates();
 
index 686db507c140981389a4383bb31122401d058adb..a7c4e15d10059b8a6c6d351fb64f367b56a67aac 100644 (file)
@@ -10,12 +10,12 @@ package org.opendaylight.yangtools.yang.data.tree.leafref;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
-import org.opendaylight.yangtools.concepts.Builder;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.concepts.Mutable;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 
-class QNameWithPredicateBuilder implements Builder<QNameWithPredicate> {
-
+class QNameWithPredicateBuilder implements Mutable {
     private final List<QNamePredicate> qnamePredicates = new ArrayList<>();
     private QNameModule moduleQname;
     private String localName;
@@ -32,8 +32,7 @@ class QNameWithPredicateBuilder implements Builder<QNameWithPredicate> {
         this.localName = localName;
     }
 
-    @Override
-    public QNameWithPredicate build() {
+    public @NonNull QNameWithPredicate build() {
         if (qnamePredicates.isEmpty() && moduleQname != null && localName != null) {
             return new SimpleQNameWithPredicate(QName.create(moduleQname, localName));
         }