Populate ietf-restconf operations container
[yangtools.git] / parser / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / StmtContext.java
index d689406428da860d365b5fa0a4bbd829d3e784b4..d940675907e05ad0d2076eaa008929102d3106d3 100644 (file)
@@ -23,9 +23,7 @@ import org.opendaylight.yangtools.yang.common.YangVersion;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
-import org.opendaylight.yangtools.yang.model.api.meta.StatementOrigin;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
-import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
 
 /**
  * An inference context associated with an instance of a statement.
@@ -36,67 +34,6 @@ import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReferenc
  */
 public interface StmtContext<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
         extends NamespaceStmtCtx, BoundStmtCtxCompat<A, D> {
-    @Deprecated(forRemoval = true)
-    default @NonNull StatementDefinition getPublicDefinition() {
-        return publicDefinition();
-    }
-
-    @Deprecated(forRemoval = true)
-    default @NonNull StatementOrigin getStatementSource() {
-        return origin();
-    }
-
-    @Deprecated(forRemoval = true)
-    default @NonNull StatementSourceReference getStatementSourceReference() {
-        return sourceReference();
-    }
-
-    /**
-     * Return the statement argument in literal format.
-     *
-     * @return raw statement argument string, or null if this statement does not have an argument.
-     * @deprecated Use {@link #rawArgument()} instead.
-     */
-    @Deprecated(forRemoval = true)
-    default @Nullable String rawStatementArgument() {
-        return rawArgument();
-    }
-
-    /**
-     * Return the statement argument in literal format.
-     *
-     * @return raw statement argument string
-     * @throws VerifyException if this statement does not have an argument
-     * @deprecated Use {@link #getRawArgument()} instead.
-     */
-    @Deprecated(forRemoval = true)
-    default @NonNull String coerceRawStatementArgument() {
-        return getRawArgument();
-    }
-
-    /**
-     * Return the statement argument.
-     *
-     * @return statement argument, or null if this statement does not have an argument
-     * @deprecated Use {@link #argument()} instead.
-     */
-    @Deprecated(forRemoval = true)
-    default @Nullable A getStatementArgument() {
-        return argument();
-    }
-
-    /**
-     * Return the statement argument in literal format.
-     *
-     * @return raw statement argument string
-     * @throws VerifyException if this statement does not have an argument
-     * @deprecated Use {@link #getArgument()} instead.
-     */
-    @Deprecated(forRemoval = true)
-    default @NonNull A coerceStatementArgument() {
-        return getArgument();
-    }
-
     /**
      * Return the parent statement context, or null if this is the root statement.
      *
@@ -146,7 +83,7 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
      *
      * @return Collection of declared substatements
      */
-    @NonNull Collection<? extends StmtContext<?, ?, ?>> declaredSubstatements();
+    @NonNull Collection<? extends @NonNull StmtContext<?, ?, ?>> declaredSubstatements();
 
     /**
      * Return effective substatements. These are the statements which are added as this statement's substatements
@@ -154,13 +91,13 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
      *
      * @return Collection of declared substatements
      */
-    @NonNull Collection<? extends StmtContext<?, ?, ?>> effectiveSubstatements();
+    @NonNull Collection<? extends @NonNull StmtContext<?, ?, ?>> effectiveSubstatements();
 
-    default Iterable<? extends StmtContext<?, ?, ?>> allSubstatements() {
+    default Iterable<? extends @NonNull StmtContext<?, ?, ?>> allSubstatements() {
         return Iterables.concat(declaredSubstatements(), effectiveSubstatements());
     }
 
-    default Stream<? extends StmtContext<?, ?, ?>> allSubstatementsStream() {
+    default Stream<? extends @NonNull StmtContext<?, ?, ?>> allSubstatementsStream() {
         return Streams.concat(declaredSubstatements().stream(), effectiveSubstatements().stream());
     }
 
@@ -295,18 +232,18 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
         }
 
         @Override
-        default Collection<? extends StmtContext<?, ?, ?>> declaredSubstatements() {
+        default Collection<? extends @NonNull StmtContext<?, ?, ?>> declaredSubstatements() {
             return mutableDeclaredSubstatements();
         }
 
-        @NonNull Collection<? extends Mutable<?, ?, ?>> mutableDeclaredSubstatements();
+        @NonNull Collection<? extends @NonNull Mutable<?, ?, ?>> mutableDeclaredSubstatements();
 
         @Override
-        default Collection<? extends StmtContext<?, ?, ?>> effectiveSubstatements() {
+        default Collection<? extends @NonNull StmtContext<?, ?, ?>> effectiveSubstatements() {
             return mutableEffectiveSubstatements();
         }
 
-        @NonNull Collection<? extends Mutable<?, ?, ?>> mutableEffectiveSubstatements();
+        @NonNull Collection<? extends @NonNull Mutable<?, ?, ?>> mutableEffectiveSubstatements();
 
         /**
          * Create a new inference action to be executed during specified phase. The action cannot be cancelled
@@ -373,21 +310,25 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
         void addEffectiveSubstatements(Collection<? extends Mutable<?, ?, ?>> statements);
 
         /**
-         * Adds a purely-effective statement to collection of substatements. The statement will report a {@code null}
+         * Create a purely-effective substatement. The statement will report a {@code null}
          * {@link EffectiveStatement#getDeclared()} object. A typical example of statements which require this mechanics
          * are {@code rpc} and {@code action} statements, which always have {@code input} and {@code output}
-         * substatements, even if those are not declared in YANG text.
+         * substatements, even if those are not declared in YANG text. The returned context is not added to this
+         * context's substatements. That needs to done once the statement is completely defined through
+         * {@link #addEffectiveSubstatement(Mutable)} -- which will trigger
+         * {@link StatementSupport#onFullDefinitionDeclared(Mutable)}.
          *
          * @param support Statement support of the statement being created
          * @param arg Effective argument. If specified as {@code null}, statement support will be consulted for the
          *            empty argument.
+         * @return A new statement
          * @throws IllegalArgumentException if {@code support} does not implement {@link UndeclaredStatementFactory}
          * @throws IllegalStateException if added in declared phase
          * @throws NullPointerException if {@code support} is null
          */
         @Beta
         <X, Y extends DeclaredStatement<X>, Z extends EffectiveStatement<X, Y>>
-            @NonNull Mutable<X, Y, Z> addUndeclaredSubstatement(StatementSupport<X, Y, Z> support, @Nullable X arg);
+            @NonNull Mutable<X, Y, Z> createUndeclaredSubstatement(StatementSupport<X, Y, Z> support, @Nullable X arg);
 
         @Beta
         void removeStatementFromEffectiveSubstatements(StatementDefinition statementDef);