Expose DataTreeSnapshot's SchemaContext
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / tree / DataTreeSnapshot.java
index 4eb268a188c2ac0fd770c9d989ecae7e8c999388..e31750f4533380a4aff987e7b84b87c94ff10096 100644 (file)
@@ -7,15 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.data.api.schema.tree;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-
-import com.google.common.base.Optional;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
- * Read-only snapshot of a {@link DataTree}. The snapshot is stable and isolated,
- * e.g. data tree changes occurring after the snapshot has been taken are not
- * visible through the snapshot.
+ * Read-only snapshot of a {@link DataTree}. The snapshot is stable and isolated, e.g. data tree changes occurring after
+ * the snapshot has been taken are not visible through the snapshot.
  */
 public interface DataTreeSnapshot {
     /**
@@ -24,14 +24,23 @@ public interface DataTreeSnapshot {
      * @param path Path of the node
      * @return Optional result encapsulating the presence and value of the node
      */
-    Optional<NormalizedNode<?, ?>> readNode(InstanceIdentifier path);
+    Optional<NormalizedNode<?, ?>> readNode(YangInstanceIdentifier path);
 
     /**
      * Create a new data tree modification based on this snapshot, using the
      * specified data application strategy.
      *
-     * @param strategy data modification strategy
      * @return A new data tree modification
      */
     DataTreeModification newModification();
+
+    /**
+     * Return the current {@link SchemaContext}, which is being used for operations.
+     *
+     * @return Current schema context.
+     */
+    // FIXME: 3.0.0: Make this method non-default.
+    default @NonNull SchemaContext getSchemaContext() {
+        throw new UnsupportedOperationException("Not implemented by  " + getClass());
+    }
 }