These are simple Sonar violations, clear them up.
Change-Id: Ib8e71154ab29e87afff8a3696c8b8749bc2806ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
* @param <V> namespace value type
* @param <N> namespace type
* @param <T> key type
- * @param <U> key type
+ * @param <U> value type
* @throws NamespaceNotAvailableException when the namespace is not available.
*/
public final <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNs(
import java.util.Map;
import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
-@SuppressWarnings("checkstyle:classTypeParameterName")
-public abstract class DerivedNamespaceBehaviour<K, V, DK, N extends IdentifierNamespace<K, V>,
- DN extends IdentifierNamespace<DK, ?>> extends NamespaceBehaviour<K, V, N> {
+/**
+ * An {@link NamespaceBehaviour} which derives keys from a different namespace.
+ *
+ * @param <K> Key type
+ * @param <V> Value type
+ * @param <N> Namespace type
+ * @param <L> Original key type
+ * @param <O> Original namespace type
+ */
+public abstract class DerivedNamespaceBehaviour<K, V, L, N extends IdentifierNamespace<K, V>,
+ O extends IdentifierNamespace<L, ?>> extends NamespaceBehaviour<K, V, N> {
- private final Class<DN> derivedFrom;
+ private final Class<O> derivedFrom;
- protected DerivedNamespaceBehaviour(final Class<N> identifier, final Class<DN> derivedFrom) {
+ protected DerivedNamespaceBehaviour(final Class<N> identifier, final Class<O> derivedFrom) {
super(identifier);
this.derivedFrom = requireNonNull(derivedFrom);
}
- public Class<DN> getDerivedFrom() {
+ public Class<O> getDerivedFrom() {
return derivedFrom;
}
// Intentional noop
}
- public abstract DK getSignificantKey(K key);
+ public abstract L getSignificantKey(K key);
}
* Invoked once all prerequisites were met and forward references were resolved and inference action should be
* applied. Implementors may perform necessary changes to mutable objects which were declared.
*
- * @throws InferenceException If inference action can not be processed.
- * Note that this exception be used for user to debug YANG sources,
- * so should provide helpful context to fix issue in sources.
+ * @throws InferenceException If inference action can not be processed. Note that this exception be used for
+ * user to debug YANG sources, so should provide helpful context to fix issue in sources.
*/
- void apply(InferenceContext ctx) throws InferenceException;
+ void apply(InferenceContext ctx);
/**
* Invoked once one of prerequisites was not met, even after all other satisfiable inference actions were
* by user to debug YANG sources, hence it should provide helpful context to fix
* the issue in sources.
*/
- void prerequisiteFailed(Collection<? extends Prerequisite<?>> failed) throws InferenceException;
+ void prerequisiteFailed(Collection<? extends Prerequisite<?>> failed);
}
/**
@Nonnull <K, E extends EffectiveStatement<?, ?>, N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>>
Prerequisite<Mutable<?, ?, E>> mutatesEffectiveCtx(StmtContext<?, ?, ?> context, Class<N> namespace, K key);
- @Nonnull <C extends StmtContext.Mutable<?, ?, ?>, CT extends C> Prerequisite<C> mutatesCtx(CT root,
- ModelProcessingPhase phase);
+ @Nonnull <C extends Mutable<?, ?, ?>, T extends C> Prerequisite<C> mutatesCtx(T root, ModelProcessingPhase phase);
- void apply(InferenceAction action) throws InferenceException;
+ /**
+ * Apply an {@link InferenceAction} when this action's prerequisites are resolved.
+ *
+ * @param action Inference action to apply
+ * @throws InferenceException if the action fails
+ * @throws NullPointerException if {@code action is null}
+ * @throws IllegalStateException if this action has an inference action already associated.
+ */
+ void apply(InferenceAction action);
/**
* Create a requirement on specified statement context to be declared.
}
public interface Registry {
+ /**
+ * Get a namespace behavior.
+ *
+ * @param type Namespace type class
+ * @param <K> key type
+ * @param <V> value type
+ * @param <N> namespace type
+ * @return Namespace behaviour
+ * @throws NamespaceNotAvailableException when the namespace is not available
+ */
<K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(Class<N> type);
}
@Override
public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(
- final Class<N> namespace) throws NamespaceNotAvailableException {
+ final Class<N> namespace) {
final NamespaceBehaviour<?, ?, ?> potential = namespaceDefinitions.get(namespace);
if (potential != null) {
checkState(namespace.equals(potential.getIdentifier()));
boolean isEnabledSemanticVersioning();
+ /**
+ * Return a value associated with specified key within a namespace.
+ *
+ * @param type Namespace type
+ * @param key Key
+ * @param <K> namespace key type
+ * @param <V> namespace value type
+ * @param <N> namespace type
+ * @param <T> key type
+ * @return Value, or null if there is no element
+ * @throws NamespaceNotAvailableException when the namespace is not available.
+ */
@Nonnull
- <K, V, KT extends K, N extends IdentifierNamespace<K, V>> V getFromNamespace(
- Class<N> type, KT key) throws NamespaceNotAvailableException;
+ <K, V, T extends K, N extends IdentifierNamespace<K, V>> V getFromNamespace(Class<N> type, T key) ;
<K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromNamespace(
Class<N> type);
@Override
Mutable<?, ?, ?> getParentContext();
- <K, V, KT extends K, VT extends V, N extends IdentifierNamespace<K, V>> void addToNs(Class<N> type, KT key,
- VT value) throws NamespaceNotAvailableException;
+ /**
+ * Associate a value with a key within a namespace.
+ *
+ * @param type Namespace type
+ * @param key Key
+ * @param value value
+ * @param <K> namespace key type
+ * @param <V> namespace value type
+ * @param <N> namespace type
+ * @param <T> key type
+ * @param <U> value type
+ * @throws NamespaceNotAvailableException when the namespace is not available.
+ */
+ <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNs(Class<N> type, T key,
+ U value);
@Nonnull
@Override
}
}
- public void validate(final StmtContext<?, ?, ?> ctx) throws InvalidSubstatementException,
- MissingSubstatementException {
+ /**
+ * Validate substatements inside a context.
+ *
+ * @param ctx Context to inspect
+ * @throws InvalidSubstatementException when there is a disallowed statement present.
+ * @throws MissingSubstatementException when a mandatory statement is missing.
+ */
+ public void validate(final StmtContext<?, ?, ?> ctx) {
final Map<StatementDefinition, Counter> stmtCounts = new HashMap<>();
for (StmtContext<?, ?, ?> stmtCtx : ctx.allSubstatements()) {