Remove childCopyOf() generic arguments
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / AbstractDeclaredStatement.java
index 7270c8ff4bf4c7671a72d8c773aef8ec4a6e0df2..c10cf9ea4a9d158dcd9cde8a71e9280a9cef2dd1 100644 (file)
@@ -5,13 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.yangtools.yang.parser.spi.meta;
 
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
@@ -22,13 +21,14 @@ import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
  * @param <A> Argument type.
  */
 public abstract class AbstractDeclaredStatement<A> implements DeclaredStatement<A> {
+    private final @NonNull ImmutableList<? extends DeclaredStatement<?>> substatements;
+    private final @NonNull StatementDefinition definition;
+    private final @NonNull StatementSource source;
+
     private final A argument;
     private final String rawArgument;
-    private final ImmutableList<? extends DeclaredStatement<?>> substatements;
-    private final StatementDefinition definition;
-    private final StatementSource source;
 
-    protected AbstractDeclaredStatement(final StmtContext<A,?,?> context) {
+    protected AbstractDeclaredStatement(final StmtContext<A, ?, ?> context) {
         rawArgument = context.rawStatementArgument();
         argument = context.getStatementArgument();
         source = context.getStatementSource();
@@ -41,18 +41,6 @@ public abstract class AbstractDeclaredStatement<A> implements DeclaredStatement<
             StmtContext::buildDeclared));
     }
 
-    /**
-     * Find first declared substatement of a particular type.
-     *
-     * @param type {@link DeclaredStatement} type
-     * @return First effective substatement, or null if no match is found.
-     * @deprecated Use {@link #findFirstDeclaredSubstatement(Class)} instead.
-     */
-    @Deprecated
-    protected final <S extends DeclaredStatement<?>> S firstDeclared(final Class<S> type) {
-        return findFirstDeclaredSubstatement(type).orElse(null);
-    }
-
     @Override
     public String rawArgument() {
         return rawArgument;
@@ -63,25 +51,18 @@ public abstract class AbstractDeclaredStatement<A> implements DeclaredStatement<
         return argument;
     }
 
-    @Nonnull
     @Override
     public StatementDefinition statementDefinition() {
         return definition;
     }
 
-    @Nonnull
     @Override
     public Collection<? extends DeclaredStatement<?>> declaredSubstatements() {
         return substatements;
     }
 
-    @Nonnull
     @Override
     public StatementSource getStatementSource() {
         return source;
     }
-
-    protected final <S extends DeclaredStatement<?>> Collection<? extends S> allDeclared(final Class<S> type) {
-        return Collections2.transform(Collections2.filter(substatements, type::isInstance), type::cast);
-    }
 }