Defer copy decisions to StatementSupport
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / StmtContext.java
index d9cbd437cc398fcf35c156bdd1806403d16a4d4e..9f81a5147f560e1fffe46d2bc0f6109ac307fa2b 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.yang.parser.spi.meta;
 
 import static com.google.common.base.Verify.verifyNotNull;
 
+import com.google.common.annotations.Beta;
 import com.google.common.base.VerifyException;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Streams;
@@ -203,8 +204,7 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
      *
      * @return Original definition, if this statement was copied.
      */
-    // FIXME: 5.0.0: this should return Optional<? extends StmtContext<A, D, E>>, is that feasible?
-    Optional<StmtContext<?, ?, ?>> getOriginalCtx();
+    Optional<StmtContext<A, D, E>> getOriginalCtx();
 
     /**
      * Return the context of the previous copy of this statement -- effectively walking towards the source origin
@@ -212,8 +212,7 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
      *
      * @return Context of the previous copy of this statement, if this statement has been copied.
      */
-    // FIXME: 5.0.0: this should return Optional<? extends StmtContext<A, D, E>>
-    Optional<? extends StmtContext<?, ?, ?>> getPreviousCopyCtx();
+    Optional<StmtContext<A, D, E>> getPreviousCopyCtx();
 
     ModelProcessingPhase getCompletedPhase();
 
@@ -292,6 +291,10 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
             return childCopyOf(stmt, type, null);
         }
 
+        @Beta
+        @NonNull Optional<? extends Mutable<?, ?, ?>> copyAsChildOf(Mutable<?, ?, ?> parent, CopyType type,
+                @Nullable QNameModule targetModule);
+
         @Override
         default Collection<? extends StmtContext<?, ?, ?>> declaredSubstatements() {
             return mutableDeclaredSubstatements();