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 type
D - Declared Statement representation
E - 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.
  • 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

      protected final SubstatementValidator substatementValidator()
      Description copied from class: StatementSupport
      Returns corresponding substatement validator of a statement support.
      Specified by:
      substatementValidator in class StatementSupport<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: StatementFactory
      Create a DeclaredStatement for specified context.
      Parameters:
      ctx - Statement context
      substatements - 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 specified DeclarationReference to a baseline declared statement. If an implementation does not support attaching DeclarationReferences, it should return the statement unchanged.
      Parameters:
      stmt - Declared statement
      reference - DeclarationReference to 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: StatementFactory
      Create a EffectiveStatement for specified context.
      Parameters:
      stmt - Effective capture of this statement's significant state
      declaredSubstatements - effectively-visible declared substatements
      inferredSubstatements - 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

      public E copyEffective(EffectiveStmtCtx.Current<A,D> stmt, E original)
      Description copied from interface: StatementFactory
      Create a EffectiveStatement copy of provided original for specified context.
      Parameters:
      stmt - Effective capture of this statement's significant state
      original - 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 note augment statement performs a real transformation.
      Parameters:
      ctx - Effective capture of this statement's significant state
      substatements - 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 context
      substatements - proposed substatements
      Returns:
      Built effective substatements