Add DataTreeConfiguration copy builder 95/65195/5
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 6 Nov 2017 18:00:56 +0000 (19:00 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 8 Nov 2017 10:24:41 +0000 (11:24 +0100)
This adds convenience methods to instantiate Builder, potentially
initialized from a base configuration.

Change-Id: I1cb5db4a0d097856dec5ebcdf9490d89fa349893
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeConfiguration.java

index cd1598b27531927dc677057b5839a8663403ce46..47612ef2a213d2374f0df5a0dbd04f319db3797f 100644 (file)
@@ -93,6 +93,17 @@ public class DataTreeConfiguration implements Immutable {
         }
     }
 
+    public static Builder builder(final TreeType treeType) {
+        return new Builder(treeType);
+    }
+
+    public Builder copyBuilder() {
+        return new Builder(treeType)
+                .setMandatoryNodesValidation(isMandatoryNodesValidationEnabled())
+                .setUniqueIndexes(isUniqueIndexEnabled())
+                .setRootPath(getRootPath());
+    }
+
     public static class Builder implements org.opendaylight.yangtools.concepts.Builder<DataTreeConfiguration> {
         private final TreeType treeType;
         private YangInstanceIdentifier rootPath;