Expand reactor documentation a bit
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / StatementSupport.java
index f4a63cf76f2d7b81685f2d3c6e3cf82e6177a3b6..f9463a0f2fe4f9ef9149b42590516cbb24b9786c 100644 (file)
@@ -5,14 +5,15 @@
  * 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.annotations.Beta;
 import java.util.Optional;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.model.api.meta.ArgumentDefinition;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
@@ -22,20 +23,15 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
  * Support for processing concrete YANG statement.
  *
  * <p>
- * This interface is intended to be implemented by developers, which want to
- * introduce support of statement to parser. Consider subclassing
- * {@link AbstractStatementSupport} for easier implementation of this interface.
+ * This interface is intended to be implemented by developers, which want to introduce support of statement to parser.
+ * Consider subclassing {@link AbstractStatementSupport} for easier implementation of this interface.
  *
- * @param <A>
- *            Argument type
- * @param <D>
- *            Declared Statement representation
- * @param <E>
- *            Effective Statement representation
+ * @param <A> Argument type
+ * @param <D> Declared Statement representation
+ * @param <E> Effective Statement representation
  */
-// FIXME: 3.0.0: do not extends ImplicitParentAwareStatementSupport
 public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
-        extends StatementDefinition, StatementFactory<A, D, E>, ImplicitParentAwareStatementSupport {
+        extends StatementDefinition, StatementFactory<A, D, E> {
 
     /**
      * Returns public statement definition, which will be present in built statements.
@@ -44,22 +40,17 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
      * Public statement definition may be used to provide different implementation of statement definition,
      * which will not retain any build specific data or context.
      *
-     * @return public statement definition, which will be present in built
-     *         statements.
+     * @return public statement definition, which will be present in built statements.
      */
-    StatementDefinition getPublicView();
+    @NonNull StatementDefinition getPublicView();
 
     /**
      * Parses textual representation of argument in object representation.
      *
-     * @param ctx
-     *            Context, which may be used to access source-specific
-     *            namespaces required for parsing.
-     * @param value
-     *            String representation of value, as was present in text source.
+     * @param ctx Context, which may be used to access source-specific namespaces required for parsing.
+     * @param value String representation of value, as was present in text source.
      * @return Parsed value
-     * @throws SourceException
-     *             when an inconsistency is detected.
+     * @throws SourceException when an inconsistency is detected.
      */
     A parseArgumentValue(StmtContext<?, ?, ?> ctx, String value);
 
@@ -88,12 +79,6 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
      */
     void onStatementAdded(StmtContext.Mutable<A, D, E> stmt);
 
-    // FIXME: 3.0.0: remove this default method
-    @Override
-    default Optional<StatementSupport<?, ?, ?>> getImplicitParentFor(final StatementDefinition stmtDef) {
-        return Optional.empty();
-    }
-
     /**
      * Invoked when statement is closed during {@link ModelProcessingPhase#SOURCE_PRE_LINKAGE} phase, only substatements
      * from this and previous phase are available.
@@ -167,8 +152,7 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
      *            argument of statement
      * @return statement support specific for supplied argument or null
      */
-    @Nullable
-    StatementSupport<?, ?, ?> getSupportSpecificForArgument(String argument);
+    @Nullable StatementSupport<?, ?, ?> getSupportSpecificForArgument(String argument);
 
     /**
      * Given a raw string representation of an argument, try to use a shared representation.
@@ -225,8 +209,8 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     }
 
     @Override
-    default QName getArgumentName() {
-        return getPublicView().getArgumentName();
+    default @NonNull Optional<ArgumentDefinition> getArgumentDefinition() {
+        return getPublicView().getArgumentDefinition();
     }
 
     @Override
@@ -238,9 +222,4 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     default Class<? extends EffectiveStatement<?,?>> getEffectiveRepresentationClass() {
         return getPublicView().getEffectiveRepresentationClass();
     }
-
-    @Override
-    default boolean isArgumentYinElement() {
-        return getPublicView().isArgumentYinElement();
-    }
 }