Propagate @NonNull collection annotations
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / ChoiceSchemaNode.java
index 5febf23f9e4f2e233481f51fc56e214ec7408786..37b4f7274e3783e045b07be5dde441b849469070 100644 (file)
@@ -14,13 +14,16 @@ import com.google.common.collect.ImmutableList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceEffectiveStatement;
 
 /**
  * A ChoiceSchemaNode defines a set of alternatives. It consists of a number of branches defined as
  * ChoiceCaseSchemaNode objects.
  */
-public interface ChoiceSchemaNode extends DataSchemaNode, AugmentationTarget, MandatoryAware {
+public interface ChoiceSchemaNode extends DataSchemaNode, AugmentationTarget, MandatoryAware,
+        EffectiveStatementEquivalent<ChoiceEffectiveStatement> {
     /**
      * Returns cases of choice, keyed by their {@link SchemaNode#getQName()}. Returned map does not contain null keys
      * nor values.
@@ -28,7 +31,7 @@ public interface ChoiceSchemaNode extends DataSchemaNode, AugmentationTarget, Ma
      * @return set of ChoiceCaseNode objects defined in this node which represents set of arguments of the YANG
      *         <code>case</code> substatement of the <code>choice</code> statement.
      */
-    Collection<? extends CaseSchemaNode> getCases();
+    Collection<? extends @NonNull CaseSchemaNode> getCases();
 
     /**
      * Returns the concrete case according to specified Q name.
@@ -52,7 +55,7 @@ public interface ChoiceSchemaNode extends DataSchemaNode, AugmentationTarget, Ma
      * @throws NullPointerException if localname is null
      */
     @Beta
-    default List<? extends CaseSchemaNode> findCaseNodes(final String localname) {
+    default List<? extends @NonNull CaseSchemaNode> findCaseNodes(final String localname) {
         return getCases().stream().filter(node -> localname.equals(node.getQName().getLocalName()))
                 .collect(ImmutableList.toImmutableList());
     }