summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
dd65a7e)
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>
* @param data
* the data object to be written to the specified path
* @param createMissingParents
* @param data
* the data object to be written to the specified path
* @param createMissingParents
- * if true, any missing parent nodes will be automatically
- * created using a merge operation.
+ * if {@link #CREATE_MISSING_PARENTS} ({@code true}), any missing
+ * parent nodes will be automatically created using a merge
+ * operation.
* @throws IllegalStateException
* if the transaction has already been submitted
*/
* @throws IllegalStateException
* if the transaction has already been submitted
*/
* @param data
* the data object to be merged to the specified path
* @param createMissingParents
* @param data
* the data object to be merged to the specified path
* @param createMissingParents
- * if true, any missing parent nodes will be automatically created
- * using a merge operation.
+ * if {@link #CREATE_MISSING_PARENTS} ({@code true}), any missing
+ * parent nodes will be automatically created using a merge
+ * operation.
* @throws IllegalStateException
* if the transaction has already been submitted
*/
* @throws IllegalStateException
* if the transaction has already been submitted
*/
@Override
void delete(LogicalDatastoreType store, InstanceIdentifier<?> path);
@Override
void delete(LogicalDatastoreType store, InstanceIdentifier<?> 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;