- dependencies shared between XML and JSON PATCH implementations
Change-Id: Ia649763379fab03019ddfd16eac564da576cb35b
Signed-off-by: Ivan Hrasko <ihrasko@cisco.com>
package org.opendaylight.netconf.sal.restconf.impl;
+import javax.annotation.Nonnull;
+
/**
*
* Each YANG patch edit specifies one edit operation on the target data
MERGE,
MOVE, //delete+post
REPLACE, //put
- REMOVE //delete
-}
+ REMOVE; //delete
+
+ /**
+ * Not all patch operations support value node. Check if operation requires value or not.
+ * @param operation Name of the operation to be checked
+ * @return true if operation requires value, false otherwise
+ */
+ public static final boolean isPatchOperationWithValue(@Nonnull final String operation) {
+ switch (PATCHEditOperation.valueOf(operation.toUpperCase())) {
+ case CREATE:
+ // fall through
+ case MERGE:
+ // fall through
+ case REPLACE:
+ // fall through
+ case INSERT:
+ return true;
+ default:
+ return false;
+ }
+ }
+}
\ No newline at end of file