Interface StmtContext.Mutable<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>>

Type Parameters:
A - Argument type
D - Declared Statement representation
E - Effective Statement representation
All Superinterfaces:
BoundStmtCtx<A>, BoundStmtCtxCompat<A,D>, CommonStmtCtx, NamespaceStmtCtx, StmtContext<A,D,E>, StmtContextCompat
All Known Subinterfaces:
RootStmtContext.Mutable<A,D,E>
Enclosing interface:
StmtContext<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>>

public static interface StmtContext.Mutable<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>> extends StmtContext<A,D,E>
An mutable view of an inference context associated with an instance of a statement.
  • Method Details

    • getParentContext

      StmtContext.Mutable<?,?,?> getParentContext()
      Description copied from interface: StmtContext
      Return the parent statement context, or null if this is the root statement.
      Specified by:
      getParentContext in interface StmtContext<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>>
      Returns:
      context of parent of statement, or null if this is the root statement.
    • coerceParentContext

      default StmtContext.Mutable<?,?,?> coerceParentContext()
      Description copied from interface: StmtContext
      Return the parent statement context, forcing a VerifyException if this is the root statement.
      Specified by:
      coerceParentContext in interface StmtContext<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>>
      Returns:
      context of parent of statement
    • addToNs

      <K, V> void addToNs(@NonNull ParserNamespace<K,V> type, K key, V value)
      Associate a value with a key within a namespace.
      Type Parameters:
      K - key type
      V - value type
      Parameters:
      type - Namespace type
      key - Key
      value - value
      Throws:
      NamespaceNotAvailableException - when the namespace is not available.
    • getRoot

      RootStmtContext.Mutable<?,?,?> getRoot()
      Description copied from interface: StmtContext
      Returns the model root for this statement.
      Specified by:
      getRoot in interface StmtContext<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>>
      Returns:
      root context of statement
    • childCopyOf

      StmtContext.Mutable<?,?,?> childCopyOf(StmtContext<?,?,?> stmt, CopyType type, @Nullable QNameModule targetModule)
      Create a child sub-statement, which is a child of this statement, inheriting all attributes from specified child and recording copy type. Resulting object may only be added as a child of this statement.
      Parameters:
      stmt - Statement to be used as a template
      type - Type of copy to record in history
      targetModule - Optional new target module
      Returns:
      copy of statement considering CopyType (augment, uses)
      Throws:
      IllegalArgumentException - if stmt cannot be copied into this statement, for example because it comes from an alien implementation.
      SourceException - instance of SourceException
    • childCopyOf

      default StmtContext.Mutable<?,?,?> childCopyOf(StmtContext<?,?,?> stmt, CopyType type)
      Create a child sub-statement, which is a child of this statement, inheriting all attributes from specified child and recording copy type. Resulting object may only be added as a child of this statement.
      Parameters:
      stmt - Statement to be used as a template
      type - Type of copy to record in history
      Returns:
      copy of statement considering CopyType (augment, uses)
      Throws:
      IllegalArgumentException - if stmt cannot be copied into this statement, for example because it comes from an alien implementation.
      SourceException - instance of SourceException
    • declaredSubstatements

      default Collection<? extends @NonNull StmtContext<?,?,?>> declaredSubstatements()
      Description copied from interface: StmtContext
      Return declared substatements. These are the statements which are explicitly written in the source model, but reflect implicit containment statements as well. To but that statement into practical terms, this snippet:
         
           choice foo {
             container bar;
           }
         
       
      reports the same structure as the canonical verbose equivalent:
         
           choice foo {
             case bar {
               container bar;
             }
           }
         
       
      Returned collection is therefore well suited for reasoning about the schema tree. It is not appropriate for populating populating DeclaredStatement.declaredSubstatements().
      Specified by:
      declaredSubstatements in interface StmtContext<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>>
      Returns:
      Collection of declared substatements
    • mutableDeclaredSubstatements

      @NonNull Collection<? extends @NonNull StmtContext.Mutable<?,?,?>> mutableDeclaredSubstatements()
    • effectiveSubstatements

      default Collection<? extends @NonNull StmtContext<?,?,?>> effectiveSubstatements()
      Description copied from interface: StmtContext
      Return effective substatements. These are the statements which are added as this statement's substatements complete their effective model phase.
      Specified by:
      effectiveSubstatements in interface StmtContext<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>>
      Returns:
      Collection of declared substatements
    • mutableEffectiveSubstatements

      @NonNull Collection<? extends @NonNull StmtContext.Mutable<?,?,?>> mutableEffectiveSubstatements()
    • newInferenceAction

      @NonNull ModelActionBuilder newInferenceAction(@NonNull ModelProcessingPhase phase)
      Create a new inference action to be executed during specified phase. The action cannot be cancelled and will be executed even if its definition remains incomplete. The specified phase cannot complete until this action is resolved. If the action cannot be resolved, model processing will fail.
      Parameters:
      phase - Target phase in which the action will resolved.
      Returns:
      A new action builder.
      Throws:
      NullPointerException - if the specified phase is null
    • setRootVersion

      void setRootVersion(YangVersion version)
      Set version of root statement context.
      Parameters:
      version - of root statement context
    • addRequiredSource

      void addRequiredSource(SourceIdentifier dependency)
      Add required module. Based on these dependencies are collected required sources from library sources.
      Parameters:
      dependency - SourceIdentifier of module required by current root context
    • addEffectiveSubstatement

      void addEffectiveSubstatement(StmtContext.Mutable<?,?,?> substatement)
      Adds an effective statement to collection of substatements.
      Parameters:
      substatement - substatement
      Throws:
      IllegalStateException - if added in declared phase
      NullPointerException - if substatement is null
    • addEffectiveSubstatements

      void addEffectiveSubstatements(Collection<? extends StmtContext.Mutable<?,?,?>> statements)
      Adds an effective statement to collection of substatements.
      Parameters:
      statements - substatements
      Throws:
      IllegalStateException - if added in declared phase
      NullPointerException - if statement parameter is null
    • createUndeclaredSubstatement

      @Beta <X, Y extends DeclaredStatement<X>, Z extends EffectiveStatement<X, Y>> @NonNull StmtContext.Mutable<X,Y,Z> createUndeclaredSubstatement(StatementSupport<X,Y,Z> support, @Nullable X arg)
      Create a purely-effective substatement. The statement will report a null EffectiveStatement.getDeclared() object. A typical example of statements which require this mechanics are rpc and action statements, which always have input and output 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 addEffectiveSubstatement(Mutable) -- which will trigger StatementSupport.onFullDefinitionDeclared(Mutable).
      Parameters:
      support - Statement support of the statement being created
      arg - Effective argument. If specified as null, statement support will be consulted for the empty argument.
      Returns:
      A new statement
      Throws:
      IllegalArgumentException - if support does not implement UndeclaredStatementFactory
      IllegalStateException - if added in declared phase
      NullPointerException - if support is null
    • removeStatementFromEffectiveSubstatements

      @Beta void removeStatementFromEffectiveSubstatements(StatementDefinition statementDef)
    • removeStatementFromEffectiveSubstatements

      @Beta void removeStatementFromEffectiveSubstatements(StatementDefinition statementDef, String statementArg)
      Removes a statement context from the effective substatements based on its statement definition (i.e statement keyword) and raw (in String form) statement argument. The statement context is removed only if both statement definition and statement argument match with one of the effective substatements' statement definition and argument.

      If the statementArg parameter is null, the statement context is removed based only on its statement definition.

      Parameters:
      statementDef - statement definition of the statement context to remove
      statementArg - statement argument of the statement context to remove
    • hasImplicitParentSupport

      @Beta boolean hasImplicitParentSupport()
    • wrapWithImplicit

      @Beta StmtContext<?,?,?> wrapWithImplicit(StmtContext<?,?,?> original)
    • addAsEffectOfStatement

      void addAsEffectOfStatement(Collection<? extends StmtContext<?,?,?>> ctxs)
    • setRootIdentifier

      void setRootIdentifier(SourceIdentifier identifier)
      Set identifier of current root context.
      Parameters:
      identifier - of current root context, must not be null
    • setUnsupported

      void setUnsupported()