Class AbstractStatementSupport<A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>,E extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<A,D>>
java.lang.Object
org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport<A,D,E>
org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport<A,D,E>
- Type Parameters:
A- Argument typeD- Declared Statement representationE- Effective Statement representation
- All Implemented Interfaces:
StatementFactory<A,D, E>
- Direct Known Subclasses:
AbstractBooleanStatementSupport,AbstractEmptyStatementSupport,AbstractInternedStatementSupport,AbstractQNameStatementSupport,AbstractStringStatementSupport,AbstractUnqualifiedStatementSupport
@Beta
public abstract class AbstractStatementSupport<A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>,E extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<A,D>>
extends StatementSupport<A,D,E>
Baseline implementation class for common
StatementSupport implementations. This class performs many of the
its duties in the canonical way -- taking away some amount of freedom for common functionality.-
Nested Class Summary
Nested classes/interfaces inherited from class org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport
StatementSupport.CopyPolicy, StatementSupport.StatementEquality<A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>, StatementSupport.StatementPolicy<A, D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStatementSupport(org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition publicDefinition, StatementSupport.StatementPolicy<A, D> policy, org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration config, @Nullable SubstatementValidator validator) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract @NonNull DattachDeclarationReference(@NonNull D stmt, @NonNull org.opendaylight.yangtools.yang.model.api.meta.DeclarationReference reference) Attach specifiedDeclarationReferenceto a baseline declared statement.protected @NonNull com.google.common.collect.ImmutableList<? extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?,?>> buildEffectiveSubstatements(EffectiveStmtCtx.Current<A, D> stmt, List<? extends StmtContext<?, ?, ?>> substatements) Create a set of substatements.copyEffective(EffectiveStmtCtx.Current<A, D> stmt, E original) Create aEffectiveStatementcopy of provided original for specified context.protected abstract @NonNull DcreateDeclared(@NonNull BoundStmtCtx<A> ctx, @NonNull com.google.common.collect.ImmutableList<org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>> substatements) final DcreateDeclared(BoundStmtCtx<A> ctx, Stream<org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>> substatements) Create aDeclaredStatementfor specified context.protected abstract @NonNull EcreateEffective(@NonNull EffectiveStmtCtx.Current<A, D> stmt, @NonNull com.google.common.collect.ImmutableList<? extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?, ?>> substatements) final EcreateEffective(EffectiveStmtCtx.Current<A, D> stmt, Stream<? extends StmtContext<?, ?, ?>> declaredSubstatements, Stream<? extends StmtContext<?, ?, ?>> inferredSubstatements) Create aEffectiveStatementfor specified context.static final <A,E extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<A, ?>>
AfindFirstArgument(Collection<? extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?, ?>> statements, Class<@NonNull E> type, A defValue) static final <E extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?,?>>
@Nullable EfindFirstStatement(Collection<? extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?, ?>> statements, Class<E> type) protected List<? extends StmtContext<?,?, ?>> statementsToBuild(EffectiveStmtCtx.Current<A, D> ctx, List<? extends StmtContext<?, ?, ?>> substatements) Give statement support a hook to transform statement contexts before they are built.protected final SubstatementValidatorReturns corresponding substatement validator of a statement support.Methods inherited from class org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport
adaptArgumentValue, argumentName, canReuseCurrent, copyPolicy, definition, extractEffectiveState, getArgumentDefinition, getPublicView, getSupportSpecificForArgument, hasArgumentSpecificSupports, internArgument, isIgnoringConfig, isIgnoringIfFeatures, onFullDefinitionDeclared, onLinkageDeclared, onPreLinkageDeclared, onStatementAdded, onStatementDefinitionDeclared, parseArgumentValue, statementName
-
Constructor Details
-
AbstractStatementSupport
protected AbstractStatementSupport(org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition publicDefinition, StatementSupport.StatementPolicy<A, D> policy, org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration config, @Nullable SubstatementValidator validator)
-
-
Method Details
-
substatementValidator
Description copied from class:StatementSupportReturns corresponding substatement validator of a statement support.- Specified by:
substatementValidatorin classStatementSupport<A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>, E extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<A, D>> - Returns:
- substatement validator or null, if substatement validator is not defined
-
createDeclared
public final D createDeclared(BoundStmtCtx<A> ctx, Stream<org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>> substatements) Description copied from interface:StatementFactoryCreate aDeclaredStatementfor specified context.- Parameters:
ctx- Statement contextsubstatements- Declared substatements- Returns:
- A declared statement instance.
-
createDeclared
protected abstract @NonNull D createDeclared(@NonNull BoundStmtCtx<A> ctx, @NonNull com.google.common.collect.ImmutableList<org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>> substatements) -
attachDeclarationReference
protected abstract @NonNull D attachDeclarationReference(@NonNull D stmt, @NonNull org.opendaylight.yangtools.yang.model.api.meta.DeclarationReference reference) Attach specifiedDeclarationReferenceto a baseline declared statement. If an implementation does not support attaching DeclarationReferences, it should return the statement unchanged.- Parameters:
stmt- Declared statementreference-DeclarationReferenceto attach- Returns:
- Equivalent of stmt, potentially with specified reference attached.
-
createEffective
public final E createEffective(EffectiveStmtCtx.Current<A, D> stmt, Stream<? extends StmtContext<?, ?, ?>> declaredSubstatements, Stream<? extends StmtContext<?, ?, ?>> inferredSubstatements) Description copied from interface:StatementFactoryCreate aEffectiveStatementfor specified context.- Parameters:
stmt- Effective capture of this statement's significant statedeclaredSubstatements- effectively-visible declared substatementsinferredSubstatements- effectively-visible inferred substatements- Returns:
- An effective statement instance
-
createEffective
protected abstract @NonNull E createEffective(@NonNull EffectiveStmtCtx.Current<A, D> stmt, @NonNull com.google.common.collect.ImmutableList<? extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?, ?>> substatements) -
copyEffective
Description copied from interface:StatementFactoryCreate aEffectiveStatementcopy of provided original for specified context.- Parameters:
stmt- Effective capture of this statement's significant stateoriginal- Original effective statement- Returns:
- An effective statement instance
-
statementsToBuild
protected List<? extends StmtContext<?,?, statementsToBuild?>> (EffectiveStmtCtx.Current<A, D> ctx, List<? extends StmtContext<?, ?, ?>> substatements) Give statement support a hook to transform statement contexts before they are built. Default implementation does nothing, but noteaugmentstatement performs a real transformation.- Parameters:
ctx- Effective capture of this statement's significant statesubstatements- Substatement contexts which have been determined to be built- Returns:
- Substatement context which are to be actually built
-
findFirstStatement
public static final <E extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?,?>> @Nullable E findFirstStatement(Collection<? extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?, ?>> statements, Class<E> type) -
findFirstArgument
public static final <A,E extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<A, A findFirstArgument?>> (Collection<? extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?, ?>> statements, Class<@NonNull E> type, A defValue) -
buildEffectiveSubstatements
protected @NonNull com.google.common.collect.ImmutableList<? extends org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement<?,?>> buildEffectiveSubstatements(EffectiveStmtCtx.Current<A, D> stmt, List<? extends StmtContext<?, ?, ?>> substatements) Create a set of substatements. This method is split out so it can be overridden in subclasses adjust the resulting statements.- Parameters:
stmt- Current statement contextsubstatements- proposed substatements- Returns:
- Built effective substatements
-