From 6351e497332196d8aae11b1e3cbbf6ed271fe08d Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Tue, 18 Aug 2015 10:37:53 +0200 Subject: [PATCH] Add "documentation" flags for WriteTransaction In WriteTransaction, the createMissingParents argument to put() and merge() is a boolean, which results in code like ...put(store, path, data, true); which isn't immediately readable to neophytes. This patch adds two constants, CREATE_MISSING_PARENTS and FAIL_ON_MISSING_PARENTS, so that client code can be written as ...put(store, path, data, CREATE_MISSING_PARENTS); instead (but without introducing an enum). The FAIL_ON_MISSING_PARENTS constant also documents the behaviour in the other path; I named it based on the pre-condition check in AbstractWriteTransaction (which results in an IllegalArgumentException if a parent is missing). Change-Id: Ic95b5e4f3d8574f0014cdf6a00a77013b94b00cc Signed-off-by: Stephen Kitt --- .../md/sal/binding/api/WriteTransaction.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/WriteTransaction.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/WriteTransaction.java index a6ba2e2799..d99150881a 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/WriteTransaction.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/WriteTransaction.java @@ -67,8 +67,9 @@ public interface WriteTransaction extends AsyncWriteTransaction path); + + /** + * Flag value indicating that missing parents should be created. + */ + boolean CREATE_MISSING_PARENTS = true; + + /** + * Flag value indicating that missing parents should cause an error. + */ + boolean FAIL_ON_MISSING_PARENTS = false; } -- 2.36.6