Interface StmtContext.Mutable<A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A,D>>
- Type Parameters:
A
- Argument typeD
- Declared Statement representationE
- 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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext
StmtContext.Mutable<A,
D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAsEffectOfStatement
(Collection<? extends StmtContext<?, ?, ?>> ctxs) void
addEffectiveSubstatement
(StmtContext.Mutable<?, ?, ?> substatement) Adds an effective statement to collection of substatements.void
addEffectiveSubstatements
(Collection<? extends StmtContext.Mutable<?, ?, ?>> statements) Adds an effective statement to collection of substatements.void
addRequiredSource
(SourceIdentifier dependency) Add required module.<K,
V> void addToNs
(@NonNull ParserNamespace<K, V> type, K key, V value) Associate a value with a key within a namespace.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.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.default StmtContext.Mutable<?,
?, ?> Return the parent statement context, forcing a VerifyException if this is the root statement.<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.default Collection<? extends @NonNull StmtContext<?,
?, ?>> Return declared substatements.default Collection<? extends @NonNull StmtContext<?,
?, ?>> Return effective substatements.StmtContext.Mutable<?,
?, ?> Return the parent statement context, or null if this is the root statement.RootStmtContext.Mutable<?,
?, ?> getRoot()
Returns the model root for this statement.boolean
@NonNull Collection<? extends @NonNull StmtContext.Mutable<?,
?, ?>> @NonNull Collection<? extends @NonNull StmtContext.Mutable<?,
?, ?>> @NonNull ModelActionBuilder
newInferenceAction
(@NonNull ModelProcessingPhase phase) Create a new inference action to be executed during specified phase.void
removeStatementFromEffectiveSubstatements
(StatementDefinition statementDef) 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.void
setRootIdentifier
(SourceIdentifier identifier) Set identifier of current root context.void
setRootVersion
(YangVersion version) Set version of root statement context.void
StmtContext<?,
?, ?> wrapWithImplicit
(StmtContext<?, ?, ?> original) Methods inherited from interface org.opendaylight.yangtools.yang.parser.spi.meta.BoundStmtCtx
argument, findSubstatementArgument, getArgument, hasSubstatement, yangVersion
Methods inherited from interface org.opendaylight.yangtools.yang.parser.spi.meta.BoundStmtCtxCompat
declared
Methods inherited from interface org.opendaylight.yangtools.yang.parser.spi.meta.CommonStmtCtx
getRawArgument, producesDeclared, producesEffective, publicDefinition, rawArgument, sourceReference
Methods inherited from interface org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceStmtCtx
localNamespacePortion, namespace, namespaceItem
Methods inherited from interface org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext
allSubstatements, allSubstatementsStream, buildEffective, copyAsChildOf, getCompletedPhase, getEffectOfStatement, getOriginalCtx, getPreviousCopyCtx, isSupportedByFeatures, isSupportedToBuildEffective, replicaAsChildOf
Methods inherited from interface org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextCompat
history
-
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 interfaceStmtContext<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
Description copied from interface:StmtContext
Return the parent statement context, forcing a VerifyException if this is the root statement.- Specified by:
coerceParentContext
in interfaceStmtContext<A,
D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> - Returns:
- context of parent of statement
-
addToNs
Associate a value with a key within a namespace.- Type Parameters:
K
- key typeV
- value type- Parameters:
type
- Namespace typekey
- Keyvalue
- 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 interfaceStmtContext<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 templatetype
- Type of copy to record in historytargetModule
- 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
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 templatetype
- 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
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; }
choice foo { case bar { container bar; } }
DeclaredStatement.declaredSubstatements()
.- Specified by:
declaredSubstatements
in interfaceStmtContext<A,
D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> - Returns:
- Collection of declared substatements
-
mutableDeclaredSubstatements
@NonNull Collection<? extends @NonNull StmtContext.Mutable<?,?, mutableDeclaredSubstatements()?>> -
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 interfaceStmtContext<A,
D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>> - Returns:
- Collection of declared substatements
-
mutableEffectiveSubstatements
@NonNull Collection<? extends @NonNull StmtContext.Mutable<?,?, mutableEffectiveSubstatements()?>> -
newInferenceAction
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
Set version of root statement context.- Parameters:
version
- of root statement context
-
addRequiredSource
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
Adds an effective statement to collection of substatements.- Parameters:
substatement
- substatement- Throws:
IllegalStateException
- if added in declared phaseNullPointerException
- ifsubstatement
is null
-
addEffectiveSubstatements
Adds an effective statement to collection of substatements.- Parameters:
statements
- substatements- Throws:
IllegalStateException
- if added in declared phaseNullPointerException
- if statement parameter is null
-
createUndeclaredSubstatement
@Beta <X,Y extends DeclaredStatement<X>, @NonNull StmtContext.Mutable<X,Z extends EffectiveStatement<X, Y>> Y, createUndeclaredSubstatementZ> (StatementSupport<X, Y, Z> support, @Nullable X arg) Create a purely-effective substatement. The statement will report anull
EffectiveStatement.getDeclared()
object. A typical example of statements which require this mechanics arerpc
andaction
statements, which always haveinput
andoutput
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 throughaddEffectiveSubstatement(Mutable)
-- which will triggerStatementSupport.onFullDefinitionDeclared(Mutable)
.- Parameters:
support
- Statement support of the statement being createdarg
- Effective argument. If specified asnull
, statement support will be consulted for the empty argument.- Returns:
- A new statement
- Throws:
IllegalArgumentException
- ifsupport
does not implementUndeclaredStatementFactory
IllegalStateException
- if added in declared phaseNullPointerException
- ifsupport
is null
-
removeStatementFromEffectiveSubstatements
-
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 removestatementArg
- statement argument of the statement context to remove
-
hasImplicitParentSupport
-
wrapWithImplicit
-
addAsEffectOfStatement
-
setRootIdentifier
Set identifier of current root context.- Parameters:
identifier
- of current root context, must not be null
-
setUnsupported
void setUnsupported()
-