+ /**
+ * Method attempts to find DataSchemaNode inside of provided Schema Context and Yang Module accordingly to
+ * Non-conditional relative Revision Aware XPath. The specified Module MUST be present in Schema Context otherwise
+ * the operation would fail and return <code>null</code>.
+ * <br>
+ * The relative Revision Aware XPath MUST be specified WITHOUT the conditional statement (i.e. without [cond]) in
+ * path, because in this state the Schema Context is completely unaware of data state and will be not able to
+ * properly resolve XPath. If the XPath contains condition the method will return IllegalArgumentException.
+ * <br>
+ * The Actual Schema Node MUST be specified correctly because from this Schema Node will search starts. If the
+ * Actual Schema Node is not correct the operation will simply fail, because it will be unable to find desired
+ * DataSchemaNode.
+ * <br>
+ * In case that Schema Context or Module or Actual Schema Node or relative Revision Aware XPath contains
+ * <code>null</code> references the method will throw IllegalArgumentException
+ * <br>
+ * If the Revision Aware XPath doesn't have flag <code>isAbsolute == false</code> the method will
+ * throw IllegalArgumentException.
+ * <br>
+ * If the relative Revision Aware XPath is correct and desired Data Schema Node is present in Yang module or in
+ * depending module in Schema Context the method will return specified Data Schema Node,
+ * otherwise the operation will fail
+ * and method will return <code>null</code>.
+ *
+ * @throws IllegalArgumentException
+ *
+ * @param context Schema Context
+ * @param module Yang Module
+ * @param actualSchemaNode Actual Schema Node
+ * @param relativeXPath Relative Non Conditional Revision Aware XPath
+ * @return DataSchemaNode if is present in specified Schema Context for given relative Revision Aware XPath,
+ * otherwise will return <code>null</code>.
+ */
+ public static DataSchemaNode findDataSchemaNodeForRelativeXPath(final SchemaContext context, final Module module,
+ final SchemaNode actualSchemaNode, final RevisionAwareXPath relativeXPath) {
+ if (context == null) {
+ throw new IllegalArgumentException("Schema Context reference cannot be NULL!");
+ }
+ if (module == null) {
+ throw new IllegalArgumentException("Module reference cannot be NULL!");
+ }
+ if (actualSchemaNode == null) {
+ throw new IllegalArgumentException("Actual Schema Node reference cannot be NULL!");
+ }
+ if (relativeXPath == null) {
+ throw new IllegalArgumentException("Non Conditional Revision Aware XPath cannot be NULL!");
+ }
+ if (relativeXPath.isAbsolute()) {
+ throw new IllegalArgumentException("Revision Aware XPath MUST be relative i.e. MUST contains ../, "
+ + "for non relative Revision Aware XPath use findDataSchemaNode method!");
+ }