The check can be inverted to check for:
All nodes belong in TreeType.OPERATIONAL. Nodes which are in
TreeType.CONFIGURATION return this as a property.
Which can be written as a simple expression. Also expand javadoc a bit.
Change-Id: Ie10d9b4bc3f9f1e2d08f592cfec1bf4bc92ea21b
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
final Optional<TreeNode> current) throws DataValidationFailedException;
/**
- * Checks if supplied schema node belong to specified Data Tree type.
+ * Checks if supplied schema node belong to specified Data Tree type. All nodes belong to the operational tree,
+ * nodes in configuration tree are marked as such.
*
* @param treeType Tree Type
* @param node Schema node
* @return
*/
static boolean belongsToTree(final TreeType treeType, final DataSchemaNode node) {
- if(treeType == TreeType.CONFIGURATION) {
- return node.isConfiguration();
- }
- return true;
+ return treeType == TreeType.OPERATIONAL || node.isConfiguration();
}
}