Add "documentation" flags for WriteTransaction 98/25398/6
authorStephen Kitt <skitt@redhat.com>
Tue, 18 Aug 2015 08:37:53 +0000 (10:37 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 18 Sep 2015 10:55:52 +0000 (10:55 +0000)
commit6351e497332196d8aae11b1e3cbbf6ed271fe08d
tree93381ba2f2b508e3a4d3a33e589fd3cdf5457049
parentdd65a7ecf4237d0e11e01f71d2184c2bc9de2895
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 <skitt@redhat.com>
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/WriteTransaction.java

©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.