import java.util.Optional;
import java.util.Set;
import java.util.SortedMap;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
return supports.get(phase);
}
- void addSource(final @NonNull StatementStreamSource source) {
+ void addSource(final StatementStreamSource source) {
sources.add(new SourceSpecificContext(this, source));
}
- void addLibSource(final @NonNull StatementStreamSource libSource) {
+ void addLibSource(final StatementStreamSource libSource) {
checkState(currentPhase == ModelProcessingPhase.INIT,
"Add library source is allowed in ModelProcessingPhase.INIT only");
libSources.add(new SourceSpecificContext(this, libSource));
// Split out to keep generics working without a warning
private static <X, Y extends DeclaredStatement<X>, Z extends EffectiveStatement<X, Y>> void finishDeclaration(
- final UndeclaredStmtCtx<X, Y, Z> substatement) {
+ final @NonNull UndeclaredStmtCtx<X, Y, Z> substatement) {
substatement.definition().onDeclarationFinished(substatement, ModelProcessingPhase.FULL_DECLARATION);
}
* @return Stream of supported effective statements.
*/
// FIXME: this method is currently a misnomer, but unifying with streamDeclared() would make this accurate again
- abstract Stream<? extends @NonNull ReactorStmtCtx<?, ?, ?>> streamEffective();
+ abstract @NonNull Stream<? extends @NonNull ReactorStmtCtx<?, ?, ?>> streamEffective();
@Override
final boolean doTryToCompletePhase(final byte targetOrder) {
StatementDefinitionContext(final StatementSupport<A, D, E> support) {
this.support = requireNonNull(support);
- this.argumentSpecificSubDefinitions = support.hasArgumentSpecificSupports() ? new HashMap<>() : null;
+ argumentSpecificSubDefinitions = support.hasArgumentSpecificSupports() ? new HashMap<>() : null;
}
@NonNull StatementFactory<A, D, E> getFactory() {
return support;
}
- A parseArgumentValue(final StmtContext<A, D, E> context, final String value) {
+ A parseArgumentValue(final @NonNull StmtContext<A, D, E> context, final String value) {
return support.parseArgumentValue(context, value);
}
- A adaptArgumentValue(final StmtContext<A, D, E> context, final QNameModule targetModule) {
+ A adaptArgumentValue(final @NonNull StmtContext<A, D, E> context, final QNameModule targetModule) {
return support.adaptArgumentValue(context, targetModule);
}
? implicit.getImplicitParentFor(parent, stmtDef) : Optional.empty();
}
- void onStatementAdded(final Mutable<A, D, E> stmt) {
+ void onStatementAdded(final @NonNull Mutable<A, D, E> stmt) {
support.onStatementAdded(stmt);
}
- void onDeclarationFinished(final Mutable<A, D, E> statement, final ModelProcessingPhase phase) {
+ void onDeclarationFinished(final @NonNull Mutable<A, D, E> statement, final ModelProcessingPhase phase) {
switch (phase) {
case SOURCE_PRE_LINKAGE:
support.onPreLinkageDeclared(statement);
private final @NonNull StatementDefinition publicDefinition;
private final @NonNull CopyPolicy copyPolicy;
- @Beta
protected StatementSupport(final StatementSupport<A, D, E> delegate) {
checkArgument(delegate != this);
publicDefinition = delegate.publicDefinition;
copyPolicy = delegate.copyPolicy;
}
- @Beta
protected StatementSupport(final StatementDefinition publicDefinition, final StatementPolicy<A, D> policy) {
this.publicDefinition = requireNonNull(publicDefinition);
this.policy = requireNonNull(policy);
* @return Parsed value
* @throws SourceException when an inconsistency is detected.
*/
- public abstract A parseArgumentValue(StmtContext<?, ?, ?> ctx, String value);
+ public abstract A parseArgumentValue(@NonNull StmtContext<?, ?, ?> ctx, String value);
/**
* Adapts the argument value to match a new module. Default implementation returns original value stored in context,
* @param stmt Context of added statement. Argument and statement parent is accessible.
* @throws SourceException when an inconsistency is detected.
*/
- public void onStatementDefinitionDeclared(final Mutable<A, D, E> stmt) {
+ public void onStatementDefinitionDeclared(final @NonNull Mutable<A, D, E> stmt) {
// NOOP for most implementations
}
* @param stmt Context of added statement. Argument and statement parent is accessible.
* @throws SourceException when an inconsistency is detected.
*/
- public void onFullDefinitionDeclared(final Mutable<A, D, E> stmt) {
+ public void onFullDefinitionDeclared(final @NonNull Mutable<A, D, E> stmt) {
final SubstatementValidator validator = substatementValidator();
if (validator != null) {
validator.validate(stmt);
* @throws NullPointerException if any of the arguments are null
* @throws SourceException if the string is not a valid YANG identifier
*/
- public static @NonNull QName parseIdentifier(final StmtContext<?, ?, ?> ctx, final String str) {
+ public static @NonNull QName parseIdentifier(final @NonNull StmtContext<?, ?, ?> ctx, final String str) {
SourceException.throwIf(str.isEmpty(), ctx, "Identifier may not be an empty string");
return internedQName(ctx, str);
}
- public static @NonNull QName parseNodeIdentifier(final StmtContext<?, ?, ?> ctx, final String prefix,
+ public static @NonNull QName parseNodeIdentifier(final @NonNull StmtContext<?, ?, ?> ctx, final String prefix,
final String localName) {
return internedQName(ctx,
InferenceException.throwIfNull(getModuleQNameByPrefix(ctx, prefix), ctx,
* @throws NullPointerException if any of the arguments are null
* @throws SourceException if the string is not a valid YANG node identifier
*/
- public static @NonNull QName parseNodeIdentifier(final StmtContext<?, ?, ?> ctx, final String str) {
+ public static @NonNull QName parseNodeIdentifier(final @NonNull StmtContext<?, ?, ?> ctx, final String str) {
SourceException.throwIf(str.isEmpty(), ctx, "Node identifier may not be an empty string");
final int colon = str.indexOf(':');
return parseNodeIdentifier(ctx, prefix, localName);
}
- private static @NonNull QName internedQName(final StmtContext<?, ?, ?> ctx, final String localName) {
+ private static @NonNull QName internedQName(final @NonNull StmtContext<?, ?, ?> ctx, final String localName) {
return internedQName(ctx, getModuleQName(ctx), localName);
}
- private static @NonNull QName internedQName(final CommonStmtCtx ctx, final QNameModule module,
+ private static @NonNull QName internedQName(final @NonNull CommonStmtCtx ctx, final QNameModule module,
final String localName) {
final QName template;
try {