Fix checkstyle in yang-parser-spi 64/63064/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 12 Sep 2017 18:38:11 +0000 (20:38 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 14 Sep 2017 11:46:40 +0000 (11:46 +0000)
This is public contract, clean up checkstyle issues and expand documentation a bit.

Change-Id: Iead665f037bb0396bd0ff294d54c427a0e82168c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
55 files changed:
yang/yang-parser-spi/pom.xml
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/ExtensionNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/FeatureNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/GroupingNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/IdentityNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/ModuleNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/NamespaceToModule.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/PreLinkageModuleNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/SchemaNodeIdentifierNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/SubmoduleNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/TypeNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractStatementSupport.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/CopyHistory.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/DerivedIdentitiesNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/DerivedNamespaceBehaviour.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/ImportedNamespaceContext.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/InferenceException.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/InvalidSubstatementException.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/MissingSubstatementException.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/ModelActionBuilder.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/ModelProcessingPhase.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/NamespaceBehaviour.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/NamespaceNotAvailableException.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/SemanticVersionModuleNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/SemanticVersionNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementSupport.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementSupportBundle.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContext.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContextUtils.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/SubstatementValidator.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/AnyxmlSchemaLocationNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/AugmentToChoiceNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/BelongsToModuleContext.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/BelongsToPrefixToModuleIdentifier.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/BelongsToPrefixToModuleName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/DeclarationInTextSource.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ImpPrefixToModuleIdentifier.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ImpPrefixToNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ImpPrefixToSemVerModuleIdentifier.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/IncludedSubmoduleNameToIdentifier.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleCtxToModuleIdentifier.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleCtxToModuleQName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleIdentifierToModuleQName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleNameToModuleQName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleNameToNamespace.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleNamespaceForBelongsTo.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/ModuleQNameToModuleName.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/PrefixToModule.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/PrefixToModuleMap.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/QNameToStatementDefinition.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/QNameToStatementDefinitionMap.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/StatementSourceReference.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/StatementStreamSource.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/source/StatementWriter.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/validation/ValidationBundlesNamespace.java

index 4e6b17a4a28210dbc60108668ab9d220b5b8974c..a8733c1ab4fb5132dab66736d4e958fdd3bda090 100644 (file)
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
     <!--
         Maven Site Configuration
 
index c7c8bb2eb7093e539e44ce515f73910217f2f37b..f4df8a5e2092b9b8777b6e35f7f37185d0745686 100644 (file)
@@ -11,13 +11,13 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ExtensionStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+
 /**
- * Extension namespace
- *
- * All extension names defined in a module and its submodules share
- * the same extension identifier namespace.
- *
+ * Extension namespace. All extension names defined in a module and its submodules share the same
+ * extension identifier namespace, where each extension is identified by a QName formed from the
+ * defining module's QNameModule and the identifier specified in extension statement's argument.
  */
-public interface ExtensionNamespace extends StatementNamespace<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> {
+public interface ExtensionNamespace
+    extends StatementNamespace<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> {
 
 }
index 781c62fa78eb473d694980d2be014a64c08525ee..7a56e9d19de6c64d18509797e5a9487c42a764af 100644 (file)
@@ -11,14 +11,13 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.FeatureStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+
 /**
- *
- * Feature namespace
- *
- * All feature names defined in a module and its submodules share the
- * same feature identifier namespace.
- *
+ * Feature namespace. All feature names defined in a module and its submodules share the
+ * same feature identifier namespace. Each feature is identified by a QName formed from
+ * the defining module's QNameModule and the feature name.
  */
-public interface FeatureNamespace extends StatementNamespace<QName, FeatureStatement, EffectiveStatement<QName,FeatureStatement>> {
+public interface FeatureNamespace
+    extends StatementNamespace<QName, FeatureStatement, EffectiveStatement<QName, FeatureStatement>> {
 
 }
index ade35f11f6c9cc693984b4c9ca07584c3f4ee79c..7165ef6ff149e19dd7ef5cf478b75b27f308c68c 100644 (file)
@@ -10,17 +10,17 @@ package org.opendaylight.yangtools.yang.parser.spi;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.GroupingStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace.TreeScoped;
 
 /**
- * Grouping namespace
+ * Grouping namespace. * All grouping names defined within a parent node or at the top level of the module
+ * or its submodules share the same grouping identifier namespace. This namespace is scoped to all
+ * descendant nodes of the parent node or module.
  *
- * All grouping names defined within a parent node or at the top level of the
- * module or its submodules share the same grouping identifier namespace. This
- * namespace is scoped to all descendant nodes of the parent node or module.
- * This means that any descendant node may use that grouping, and it MUST NOT
- * define a grouping with the same name.
+ * <p>
+ * This means that any descendant node may use that grouping, and it MUST NOT define a grouping with the same name.
  */
-public interface GroupingNamespace extends StatementNamespace.TreeScoped<QName, GroupingStatement,EffectiveStatement<QName,GroupingStatement>> {
+public interface GroupingNamespace
+    extends TreeScoped<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> {
 
 }
index 39f287e37b76f84b45933e1a7f308a4b7c7eff53..2a990e4644472d5a2f786cedcab9aecec09f0e19 100644 (file)
@@ -13,11 +13,8 @@ import org.opendaylight.yangtools.yang.model.api.stmt.IdentityStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 
 /**
- *
- * Identity namespace
- *
- * All identity names defined in a module and its submodules share the same identity identifier namespace.
- *
+ * Identity namespace. All identity names defined in a module and its submodules share the same identity identifier
+ * namespace.
  */
 public interface IdentityNamespace extends
         StatementNamespace<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> {
index 6dadd8aec55f139aaf5b24e852221f24fa22dcb4..a300e2e696977b4abe86d93e9c130f2311c60e14 100644 (file)
@@ -13,7 +13,8 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 
 /**
- * namespace class for storing modules into Yang model storage keyed by {@link ModuleIdentifier}
+ * Module namespace. All modules known to the reactor are populated to this namespace. Each module is identified
+ * by a {@link ModuleIdentifier}.
  */
 public interface ModuleNamespace extends
         StatementNamespace<ModuleIdentifier, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
index f5b00f70869f9f9cdfebe4bdbd3bb4a957f26401..256671ebaa1e94cbefa792262918dcdfb14a487c 100644 (file)
@@ -7,12 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi;
 
-import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
-
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 
-public interface NamespaceToModule extends StatementNamespace<QNameModule, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
+/**
+ * A derived namespace allowing lookup of modules based on their {@link QNameModule}.
+ */
+public interface NamespaceToModule
+    extends StatementNamespace<QNameModule, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
 
 }
index 26806dcb5f38bc0d6bb522b28b8ece3820a1a5d3..36f8561a2838520ba84c5f303d7250983ed595e0 100644 (file)
@@ -12,7 +12,8 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 
 /**
- * pre-linkage namespace class for storing modules into Yang model storage keyed by module names
+ * Intermediate-stage namespace equivalent to ModuleNamespace except it is keyed by module names. This namespace is
+ * used to resolve inter-module references before actual linkage occurs.
  */
 public interface PreLinkageModuleNamespace extends
         StatementNamespace<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
index 6b482dd1364a9a579ef46c69e1e289842a3c1015..cbed70ad848d6532e661447d83e0c003cd56fb3d 100644 (file)
@@ -10,18 +10,18 @@ package org.opendaylight.yangtools.yang.parser.spi;
 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.stmt.SchemaNodeIdentifier;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace.TreeBased;
 
 /**
- * Schema node identifier namespace
+ * Schema node identifier namespace. All leafs, leaf-lists, lists, containers, choices, rpcs, notifications,
+ * anydata and anyxmls defined (directly or through a uses statement) within a parent node or at the top level
+ * of the module (or its submodules) share the same identifier namespace.
  *
- * All leafs, leaf-lists, lists, containers, choices, rpcs, notifications, and
- * anyxmls defined (directly or through a uses statement) within a parent node
- * or at the top level of the module or its submodules share the same identifier
- * namespace. This namespace is scoped to the parent node or module, unless the
- * parent node is a case node. In that case, the namespace is scoped to the
- * closest ancestor node that is not a case or choice node.
+ * <p>
+ * This namespace is scoped to the parent node or module, unless the parent node is a case node. In that case,
+ * the namespace is scoped to the closest ancestor node that is not a case or choice node.
  */
-public interface SchemaNodeIdentifierNamespace extends StatementNamespace.TreeBased<SchemaNodeIdentifier, DeclaredStatement<?>,EffectiveStatement<?,DeclaredStatement<?>>> {
+public interface SchemaNodeIdentifierNamespace
+    extends TreeBased<SchemaNodeIdentifier, DeclaredStatement<?>, EffectiveStatement<?, DeclaredStatement<?>>> {
 
 }
index 24584a136ed52123156dbf917b637c413bad96e1..a2bdd7d9ba4a9aa7438381b829dbba069316ad6e 100644 (file)
@@ -12,6 +12,11 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SubmoduleStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 
-public interface SubmoduleNamespace extends StatementNamespace<ModuleIdentifier, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>> {
+/**
+ * Submodule equivalent of ModuleNamespace.
+ */
+// FIXME: describe scoping of this namespace
+public interface SubmoduleNamespace
+    extends StatementNamespace<ModuleIdentifier, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>> {
 
 }
index f4606e168c8ca7b2f74f24c370443a33584025d0..e39dee487be8bb29cc2601ca75f4eef24d8af859 100644 (file)
@@ -13,16 +13,16 @@ import org.opendaylight.yangtools.yang.model.api.stmt.TypedefStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace.TreeScoped;
 
 /**
- * Derived types namespace
+ * Derived types namespace. All derived type names defined within a parent node or at the top level of the module
+ * (or its submodules) share the same type identifier namespace.
  *
- * All derived type names defined within a parent node or at the top level of
- * the module or its submodules share the same type identifier namespace. This
- * namespace is scoped to all descendant nodes of the parent node or module.
- * This means that any descendant node may use that typedef, and it MUST NOT
- * define a typedef with the same name.
+ * <p>
+ * This namespace is scoped to all descendant nodes of the parent node or module. This means that any descendant node
+ * may use that typedef, and it MUST NOT define a typedef with the same name.
  *
- * This namespace includes all type definitions implied by the language in which
- * the current statement resides (e.g. RFC6020 for YANG).
+ * <p>
+ * This namespace includes all type definitions implied by the language in which the current statement resides
+ * (e.g. RFC6020/RFC7950 for YANG 1.0/1.1).
  */
 public interface TypeNamespace extends TreeScoped<QName, TypedefStatement, TypedefEffectiveStatement> {
 
index 161c33987079c7383b0d28f23964c74551d1f854..fb2d0e32824e2b1c93a55c7db761f41ed525206d 100644 (file)
@@ -17,10 +17,8 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
 
 /**
- * Class providing necessary support for processing a YANG statement.
- *
- * This class is intended to be subclassed by developers, who want to
- * introduce support of statement to parser.
+ * Class providing necessary support for processing a YANG statement. This class is intended to be subclassed
+ * by developers who want to add semantic support for a statement to a parser reactor.
  *
  * @param <A>
  *            Argument type
@@ -79,11 +77,11 @@ public abstract class AbstractStatementSupport<A, D extends DeclaredStatement<A>
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      *
-     * Subclasses of this class may override this method to perform actions on
-     * this event or register modification action using
-     * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
+     * <p>
+     * Subclasses of this class may override this method to perform actions on this event or register a modification
+     * action using {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
      */
     @Override
     public void onPreLinkageDeclared(final StmtContext.Mutable<A, D, E> stmt) {
@@ -91,11 +89,11 @@ public abstract class AbstractStatementSupport<A, D extends DeclaredStatement<A>
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      *
-     * Subclasses of this class may override this method to perform actions on
-     * this event or register modification action using
-     * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
+     * <p>
+     * Subclasses of this class may override this method to perform actions on this event or register a modification
+     * action using {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
      */
     @Override
     public void onLinkageDeclared(final StmtContext.Mutable<A, D, E> stmt) {
@@ -103,11 +101,11 @@ public abstract class AbstractStatementSupport<A, D extends DeclaredStatement<A>
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      *
-     * Subclasses of this class may override this method to perform actions on
-     * this event or register modification action using
-     * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
+     * <p>
+     * Subclasses of this class may override this method to perform actions on this event or register a modification
+     * action using {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
      */
     @Override
     public void onStatementDefinitionDeclared(final StmtContext.Mutable<A, D, E> stmt) {
@@ -115,11 +113,11 @@ public abstract class AbstractStatementSupport<A, D extends DeclaredStatement<A>
     }
 
     /**
-     * {@inheritDoc}
+     * {@inheritDoc}.
      *
-     * Subclasses of this class may override this method to perform actions on
-     * this event or register modification action using
-     * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
+     * <p>
+     * Subclasses of this class may override this method to perform actions on this event or register a modification
+     * action using {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
      */
     @Override
     public void onFullDefinitionDeclared(final StmtContext.Mutable<A, D, E> stmt) {
@@ -149,7 +147,7 @@ public abstract class AbstractStatementSupport<A, D extends DeclaredStatement<A>
     }
 
     /**
-     * Returns corresponding substatement validator of a statement support
+     * Returns corresponding substatement validator of a statement support.
      *
      * @return substatement validator or null, if substatement validator is not
      *         defined
index 10eb0fa252dee83ab45005fe449642cd034f68e4..32f21c907632b3504917bb08ccec5b155ed668f1 100644 (file)
@@ -17,6 +17,7 @@ public final class CopyHistory implements Immutable {
     private static final CopyType[] VALUES = CopyType.values();
 
     private static final CopyHistory[][] CACHE = new CopyHistory[VALUES.length][];
+
     static {
         /*
          * Cache size is dependent on number of items in CopyType, it costs N * 2^N objects.
index d8e7d6db52e84dcf61e9b0d1d09bee6502b23db0..78fd53a044814e530b700035e05b9a8082a32189 100644 (file)
@@ -12,13 +12,10 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Identity namespace
- *
- * All identity names defined in a module and its submodules share the same
- * identity identifier namespace.
- *
+ * Identity namespace. All identity names defined in a module and its submodules share the same identity identifier
+ * namespace.
  */
+// FIXME: describe scoping and value
 public interface DerivedIdentitiesNamespace extends IdentifierNamespace<QName, List<StmtContext<?, ?, ?>>> {
 
 }
index 2407aa9ccf1988b660c590dc18bc8ae07236cb3a..f4193bea7b5166888b8db28a420a29223ee19c3f 100644 (file)
@@ -11,10 +11,11 @@ import com.google.common.base.Preconditions;
 import java.util.Map;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
-public abstract class DerivedNamespaceBehaviour<K, V, DK, N extends IdentifierNamespace<K, V>, DN extends IdentifierNamespace<DK, ?>>
-        extends NamespaceBehaviour<K, V, N> {
+@SuppressWarnings("checkstyle:classTypeParameterName")
+public abstract class DerivedNamespaceBehaviour<K, V, DK, N extends IdentifierNamespace<K, V>,
+       DN extends IdentifierNamespace<DK, ?>> extends NamespaceBehaviour<K, V, N> {
 
-    private Class<DN> derivedFrom;
+    private final Class<DN> derivedFrom;
 
     protected DerivedNamespaceBehaviour(Class<N> identifier, Class<DN> derivedFrom) {
         super(identifier);
index 6197562075da77211815a84de920bb192ebcd348..d02d4e8c493ba4f080f274cd4c23e7569f06a50a 100644 (file)
@@ -10,12 +10,12 @@ package org.opendaylight.yangtools.yang.parser.spi.meta;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
  * Special namespace which allows import of namespaces from other sources.
  *
  * <p>
  * This namespace and its subclasses are used by model processor to
  * link / import namespaces to context node from supplied {@link StmtContext}.
+ *
  * <p>
  * This abstraction allows for imports and includes be implement as derived
  * namespaces of this, but is not tied only for import and include statements.
index c1cb981ed75c4f0b866f021478da1ca38eaccd9d..6119e51e6d321e87f8c33b9373467fb466181e5e 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
 
 /**
- * Thrown when there was inference error
+ * Thrown when there is an inference error.
  */
 public class InferenceException extends SourceException {
     private static final long serialVersionUID = 1L;
index 3412ee7175233ee63f2695b5d0ba1869702122ef..99c9c19754f4208de099b209d40c0a3f60ecb46d 100644 (file)
@@ -12,20 +12,21 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
 
 /**
- * Thrown when there was Invalid element in yang file
+ * Thrown when there was invalid element in YANG file.
  */
 public class InvalidSubstatementException extends SourceException {
     private static final long serialVersionUID = 1L;
 
+    public InvalidSubstatementException(@Nonnull final String message,
+            @Nonnull final StatementSourceReference source) {
+        super(message, source);
+    }
+
     public InvalidSubstatementException(@Nonnull final String message, @Nonnull final StatementSourceReference source,
             final Throwable cause) {
         super(message, source, cause);
     }
 
-    public InvalidSubstatementException(@Nonnull final String message, @Nonnull final StatementSourceReference source) {
-        super(message, source);
-    }
-
     public InvalidSubstatementException(@Nonnull final StatementSourceReference source, @Nonnull final String format,
             final Object... args) {
         this(String.format(format, args), source);
index d2570dbed771952e82ec106cdf2e2196631eff87..70b0dcf752cf8ff9f8c46ff533272db8b082405a 100644 (file)
@@ -12,12 +12,13 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
 
 /**
- * Thrown when there was Missing element in yang file
+ * Thrown when there was Missing element in yang file.
  */
 public class MissingSubstatementException extends SourceException {
     private static final long serialVersionUID = 1L;
 
-    public MissingSubstatementException(@Nonnull final String message, @Nonnull final StatementSourceReference source) {
+    public MissingSubstatementException(@Nonnull final String message,
+            @Nonnull final StatementSourceReference source) {
         super(message, source);
     }
 
index 1693b73c05813a596c0eb1e5193770d8194281a6..eb6337a83948921cb16fc3b0fcbf66685d099a19 100644 (file)
@@ -16,36 +16,30 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 
-
 /**
- * Builder for effective model inference action.
- *
- * Model inference action is core principle of transforming
+ * Builder for effective model inference action. Model inference action is core principle of transforming
  * declared model into effective model.
  *
- * Since YANG allows forward references, some inference actions
- * need to be taken at a later point, where reference is actually
- * resolved. Referenced objects are not retrieved directly
- * but are represented as {@link Prerequisite} (prerequisite) for
- * inference action to be taken.
+ * <p>
+ * Since YANG allows forward references, some inference actions need to be taken at a later point, where reference is
+ * actually resolved. Referenced objects are not retrieved directly but are represented as {@link Prerequisite}
+ * (prerequisite) for inference action to be taken.
  *
- * Some existing YANG statements are more complex and also object,
- * for which effective model may be inferred is also represented
- * as {@link Prerequisite} which once, when reference is available
- * will contain target context, which may be used for inference
- * action.
+ * <p>
+ * Some existing YANG statements are more complex and also object, for which effective model may be inferred is also
+ * represented as a {@link Prerequisite} which, when reference is available, will contain target context, which may be
+ * used for inference action.
  *
  * <h2>Implementing inference action</h2>
- *
- * Effective inference action could always be splitted into two
- * separate tasks:
+ * Effective inference action could always be splitted into two separate tasks:
  * <ol>
  * <li>Declaration of inference action and its prerequisites</li>
  * <li>Execution of inference action</li>
  * </ol>
+ *
+ * <p>
  * In order to declare inference action following steps needs
  * to be taken:
- *
  * <ol>
  * <li>Use {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)} to obtain
  * {@link ModelActionBuilder}.
@@ -57,7 +51,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
  * to register inference action.
  * </ol>
  *
- * Action will be executed when:
+ * <p>
+ * An action will be executed when:
  * <ul>
  * <li> {@link InferenceAction#apply(InferenceContext)} - all prerequisites (and declared forward references) are met,
  * action could dereference them and start applying changes.
@@ -67,19 +62,17 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
  * </li>
  * </ul>
  *
+ * <p>
  * TODO: Insert real word example
  *
  * <h2>Design notes</h2>
- * {@link java.util.concurrent.Future} seems as viable and more standard
- * alternative to {@link Prerequisite}, but futures also carries
- * promise that resolution of it is carried in other
- * thread, which will actually put additional constraints on
- * semantic parser.
+ * {@link java.util.concurrent.Future} seems as viable and more standard alternative to {@link Prerequisite}, but
+ * Futures also carries promise that resolution of it is carried in other thread, which will actually put additional
+ * constraints on semantic parser.
  *
- * Also listening on multiple futures is costly, so we opted
- * out of future and designed API, which later may introduce
+ * <p>
+ * Also listening on multiple futures is costly, so we opted out of future and designed API, which later may introduce
  * futures.
- *
  */
 public interface ModelActionBuilder {
     interface InferenceContext {
@@ -103,11 +96,8 @@ public interface ModelActionBuilder {
     interface InferenceAction {
 
         /**
-         * Invoked once all prerequisites were met and forward references
-         * were resolved and inference action should be applied.
-         *
-         * Implementors may do necessary changes to mutable objects
-         * which were declared.
+         * 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,
@@ -116,19 +106,21 @@ public interface ModelActionBuilder {
         void apply(InferenceContext ctx) throws InferenceException;
 
         /**
-         * Invoked once one of prerequisites was not met,
-         * even after all other satisfiable inference actions were processed.
+         * Invoked once one of prerequisites was not met, even after all other satisfiable inference actions were
+         * processed.
          *
-         * Implementors MUST throw {@link InferenceException} if semantic processing
-         * of model should be stopped and failed.
+         * <p>
+         * Implementors MUST throw {@link InferenceException} if semantic processing of model should be stopped
+         * and failed.
          *
-         * List of failed prerequisites should be used to select right message / error
-         * type to debug problem in YANG sources.
+         * <p>
+         * List of failed prerequisites should be used to select right message / error type to debug problem in YANG
+         * sources.
          *
          * @param failed collection of prerequisites which were not met
-         * @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
+         *                            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;
     }
@@ -142,6 +134,15 @@ public interface ModelActionBuilder {
      */
     @Nonnull <D extends DeclaredStatement<?>> Prerequisite<D> requiresDeclared(StmtContext<?, ? extends D, ?> context);
 
+    /**
+     * Create a requirement on specified statement to be declared.
+     *
+     * @deprecated Undocumented method. Use at your own risk.
+     */
+    @Deprecated
+    @Nonnull <K, D extends DeclaredStatement<?>, N extends StatementNamespace<K, ? extends D, ?>>
+        Prerequisite<D> requiresDeclared(StmtContext<?, ?, ?> context, Class<N> namespace, K key);
+
     /**
      * Action requires that the specified context completes specified phase.
      *
@@ -152,7 +153,7 @@ public interface ModelActionBuilder {
     @Nonnull <A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
         Prerequisite<StmtContext<A, D, E>> requiresCtx(StmtContext<A, D, E> context, ModelProcessingPhase phase);
 
-    @Nonnull <K, N extends StatementNamespace<K, ?, ? >> Prerequisite<StmtContext<?,?,?>> requiresCtx(
+    @Nonnull <K, N extends StatementNamespace<K, ?, ?>> Prerequisite<StmtContext<?, ?, ?>> requiresCtx(
         StmtContext<?, ?, ?> context, Class<N> namespace, K key, ModelProcessingPhase phase);
 
     default @Nonnull <T extends Mutable<?, ?, ?>> Prerequisite<T> mutatesEffectiveCtx(final T stmt) {
@@ -168,13 +169,8 @@ public interface ModelActionBuilder {
     void apply(InferenceAction action) throws InferenceException;
 
     /**
-     * @deprecated Undocumented method. Use at your own risk.
-     */
-    @Deprecated
-    @Nonnull <K, D extends DeclaredStatement<?>, N extends StatementNamespace<K, ? extends D, ?>>
-        Prerequisite<D> requiresDeclared(StmtContext<?, ?, ?> context, Class<N> namespace, K key);
-
-    /**
+     * Create a requirement on specified statement context to be declared.
+     *
      * @deprecated Undocumented method. Use at your own risk.
      */
     @Deprecated
@@ -182,6 +178,8 @@ public interface ModelActionBuilder {
         Prerequisite<StmtContext<?, D, ?>> requiresDeclaredCtx(StmtContext<?, ?, ?> context, Class<N> namespace, K key);
 
     /**
+     * Create a requirement on specified statement to become effective.
+     *
      * @deprecated Undocumented method. Use at your own risk.
      */
     @Deprecated
@@ -189,6 +187,8 @@ public interface ModelActionBuilder {
             StmtContext<?, ?, ? extends E> stmt);
 
     /**
+     * Create a requirement on specified statement to become effective.
+     *
      * @deprecated Undocumented method. Use at your own risk.
      */
     @Deprecated
@@ -196,6 +196,8 @@ public interface ModelActionBuilder {
         Prerequisite<E> requiresEffective(StmtContext<?, ?, ?> context, Class<N> namespace, K key);
 
     /**
+     * Create a requirement on specified statement context to become effective.
+     *
      * @deprecated Undocumented method. Use at your own risk.
      */
     @Deprecated
@@ -204,6 +206,8 @@ public interface ModelActionBuilder {
             K key);
 
     /**
+     * Mark the fact that this action is mutating a namespace.
+     *
      * @deprecated Undocumented method. Use at your own risk.
      */
     @Deprecated
index 3fe2ccc0f110040d9de60f24b9ba9776cfa24111..1f7922ab708ca0145497869b6d05a3e555fafa5d 100644 (file)
@@ -11,24 +11,25 @@ import javax.annotation.Nullable;
 
 public enum ModelProcessingPhase {
     INIT(null),
+
     /**
-     *
      * Preliminary cross-source relationship resolution phase which collects
      * available module names and module namespaces. It is necessary in order to
      * correct resolution of unknown statements used in linkage phase (e.g.
      * semantic version of yang modules).
      */
     SOURCE_PRE_LINKAGE(INIT),
+
     /**
-     *
      * Cross-source relationship resolution phase.
+     *
      * <p>
-     * In this phase of processing only statements which affects cross-source
-     * relationship (e.g. imports / includes) are processed.
+     * In this phase of processing only statements which affects cross-source relationship (e.g. imports / includes)
+     * are processed.
+     *
      * <p>
-     * At end of this phase all source related contexts should be bind to their
-     * imports and includes to allow visibility of custom defined statements in
-     * following phases.
+     * At end of this phase all source related contexts should be bind to their imports and includes to allow
+     * visibility of custom defined statements in subsequent phases.
      */
     SOURCE_LINKAGE(SOURCE_PRE_LINKAGE),
     STATEMENT_DEFINITION(SOURCE_LINKAGE),
index c24b5c107c4da02ee4f348d0e7f680c1b7e8458d..4374d62b4622e2af38e35cb84d74af78eec82818 100644 (file)
@@ -15,11 +15,11 @@ import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- * Definition / implementation of specific Identifier Namespace behaviour.
- *
- * Namespace behaviour is build on top of tree of {@link NamespaceStorageNode} which represents local context of one of
- * types defined in {@link StorageNodeType}.
+ * Definition / implementation of specific Identifier Namespace behaviour. A namespace behaviour is built on top
+ * of a tree of {@link NamespaceStorageNode} which represents local context of one of types defined
+ * n {@link StorageNodeType}.
  *
+ * <p>
  * For common behaviour models please use static factories {@link #global(Class)}, {@link #sourceLocal(Class)} and
  * {@link #treeScoped(Class)}.
  *
@@ -42,6 +42,8 @@ public abstract class NamespaceBehaviour<K, V, N extends IdentifierNamespace<K,
 
     public interface NamespaceStorageNode {
         /**
+         * Return local namespace behaviour type.
+         *
          * @return local namespace behaviour type {@link NamespaceBehaviour}
          */
         StorageNodeType getStorageNodeType();
@@ -87,18 +89,14 @@ public abstract class NamespaceBehaviour<K, V, N extends IdentifierNamespace<K,
     }
 
     /**
-     *
-     * Creates global namespace behaviour for supplied namespace type.
-     *
-     * Global behaviour stores and loads all values from root {@link NamespaceStorageNode} with type of
-     * {@link StorageNodeType#GLOBAL}.
+     * Creates a global namespace behaviour for supplied namespace type. Global behaviour stores and loads all values
+     * from root {@link NamespaceStorageNode} with type of {@link StorageNodeType#GLOBAL}.
      *
      * @param identifier
      *            Namespace identifier.
      * @param <K> type parameter
      * @param <V> type parameter
      * @param <N> type parameter
-     *
      * @return global namespace behaviour for supplied namespace type.
      */
     public static @Nonnull <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> global(
@@ -107,18 +105,15 @@ public abstract class NamespaceBehaviour<K, V, N extends IdentifierNamespace<K,
     }
 
     /**
-     *
-     * Creates source-local namespace behaviour for supplied namespace type.
-     *
-     * Source-local namespace behaviour stores and loads all values from closest {@link NamespaceStorageNode} ancestor
-     * with type of {@link StorageNodeType#SOURCE_LOCAL_SPECIAL}.
+     * Creates source-local namespace behaviour for supplied namespace type. Source-local namespace behaviour stores
+     * and loads all values from closest {@link NamespaceStorageNode} ancestor with type
+     * of {@link StorageNodeType#SOURCE_LOCAL_SPECIAL}.
      *
      * @param identifier
      *            Namespace identifier.
      * @param <K> type parameter
      * @param <V> type parameter
      * @param <N> type parameter
-     *
      * @return source-local namespace behaviour for supplied namespace type.
      */
     public static <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> sourceLocal(
@@ -128,49 +123,44 @@ public abstract class NamespaceBehaviour<K, V, N extends IdentifierNamespace<K,
 
     public static <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> statementLocal(
            final Class<N> identifier) {
-       return new StorageSpecific<>(identifier, StorageNodeType.STATEMENT_LOCAL);
-   }
+        return new StorageSpecific<>(identifier, StorageNodeType.STATEMENT_LOCAL);
+    }
 
     /**
-     *
-     * Creates tree-scoped namespace behaviour for supplied namespace type.
-     *
-     * Tree-scoped namespace behaviour search for value in all storage nodes up to the root and stores values in
-     * supplied node.
+     * Creates tree-scoped namespace behaviour for supplied namespace type. Tree-scoped namespace behaviour searches
+     * for value in all storage nodes up to the root and stores values in supplied node.
      *
      * @param identifier
-     *            Namespace identifier.     *
+     *            Namespace identifier.
      * @param <K> type parameter
      * @param <V> type parameter
      * @param <N> type parameter
-     *
      * @return tree-scoped namespace behaviour for supplied namespace type.
      */
-    public static <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> treeScoped(final Class<N> identifier) {
+    public static <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> treeScoped(
+            final Class<N> identifier) {
         return new TreeScoped<>(identifier);
     }
 
     /**
-     * returns value from model namespace storage according to key param class
+     * Returns a value from model namespace storage according to key param class.
      *
      * @param storage namespace storage
      * @param key type parameter
-     *
      * @return value from model namespace storage according to key param class
      */
     public abstract V getFrom(NamespaceStorageNode storage, K key);
 
     /**
-     * returns all values of a keys of param class from model namespace storage
+     * Returns all values of a keys of param class from model namespace storage.
      *
      * @param storage namespace storage
-     *
      * @return all values of keys of param class from model namespace storage
      */
     public abstract Map<K, V> getAllFrom(NamespaceStorageNode storage);
 
     /**
-     * adds key and value to corresponding namespace storage according to param class
+     * Adds a key/value to corresponding namespace storage according to param class.
      *
      * @param storage namespace storage
      * @param key type parameter
@@ -195,11 +185,10 @@ public abstract class NamespaceBehaviour<K, V, N extends IdentifierNamespace<K,
         storage.putToLocalStorage(getIdentifier(), key, value);
     }
 
-    static class StorageSpecific<K, V, N extends IdentifierNamespace<K, V>> extends NamespaceBehaviour<K, V, N> {
-
+    static final class StorageSpecific<K, V, N extends IdentifierNamespace<K, V>> extends NamespaceBehaviour<K, V, N> {
         StorageNodeType storageType;
 
-        public StorageSpecific(final Class<N> identifier, final StorageNodeType type) {
+        StorageSpecific(final Class<N> identifier, final StorageNodeType type) {
             super(identifier);
             storageType = Preconditions.checkNotNull(type);
         }
@@ -225,12 +214,11 @@ public abstract class NamespaceBehaviour<K, V, N extends IdentifierNamespace<K,
             NamespaceStorageNode current = findClosestTowardsRoot(storage, storageType);
             addToStorage(current, key, value);
         }
-
     }
 
-    static class TreeScoped<K, V, N extends IdentifierNamespace<K, V>> extends NamespaceBehaviour<K, V, N> {
+    static final class TreeScoped<K, V, N extends IdentifierNamespace<K, V>> extends NamespaceBehaviour<K, V, N> {
 
-        public TreeScoped(final Class<N> identifier) {
+        TreeScoped(final Class<N> identifier) {
             super(identifier);
         }
 
@@ -267,7 +255,8 @@ public abstract class NamespaceBehaviour<K, V, N extends IdentifierNamespace<K,
 
     }
 
-    protected static NamespaceStorageNode findClosestTowardsRoot(final NamespaceStorageNode storage, final StorageNodeType type) {
+    protected static NamespaceStorageNode findClosestTowardsRoot(final NamespaceStorageNode storage,
+            final StorageNodeType type) {
         NamespaceStorageNode current = storage;
         while (current != null && current.getStorageNodeType() != type) {
             current = current.getParentNamespaceStorage();
index 40f8a4ed496188606877fc7a7315226f40fbab4b..6c4088febe3fff018319fd41999a336bfb46670b 100644 (file)
@@ -10,10 +10,7 @@ package org.opendaylight.yangtools.yang.parser.spi.meta;
 import com.google.common.base.Preconditions;
 
 /**
- *
- * Thrown when identifier namespace is not available (supported)
- * in specific model processing phase.
- *
+ * Thrown when identifier namespace is not available (supported) in a specific model processing phase.
  */
 public class NamespaceNotAvailableException extends RuntimeException {
 
index 4f5f83eef9efa44c0692951f01415fd37c91ec8e..cea95fbed50fcc78b3246dc936d75c7c94603ddf 100644 (file)
@@ -17,5 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
  * used only in case the semantic versioning is enabled, otherwise it is empty.
  */
 @Beta
-public interface SemanticVersionModuleNamespace extends IdentifierNamespace<String, NavigableMap<SemVer, StmtContext<?, ?, ?>>> {
+public interface SemanticVersionModuleNamespace
+    extends IdentifierNamespace<String, NavigableMap<SemVer, StmtContext<?, ?, ?>>> {
+
 }
index 40a7dbba5ba4829364b410a79be5cc12f0537f37..f03eaf3476a54a9345032f626473bcd25d590141 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.yangtools.concepts.SemVer;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- * namespace class for storing semantic version of yang modules
+ * Namespace class for storing semantic version of yang modules.
  */
 @Beta
 public interface SemanticVersionNamespace extends IdentifierNamespace<StmtContext<?, ?, ?>, SemVer> {
index c044e1a6ce3d464dcb5b929bc5c9b0704c17df42..fbb7f449cf3561ca30f7dd30a71d8ee4aa12ed66 100644 (file)
@@ -36,12 +36,11 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
         extends StatementDefinition, StatementFactory<A, D, E> {
 
     /**
-     * Returns public statement definition, which will be present in built
-     * statements.
+     * Returns public statement definition, which will be present in built statements.
      *
-     * Public statement definition may be used to provide different
-     * implementation of statement definition, which will not retain any build
-     * specific data or context.
+     * <p>
+     * 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.
@@ -88,24 +87,22 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     void onStatementAdded(StmtContext.Mutable<A, D, E> stmt);
 
     /**
-     * Returns implicit parent statement support for supplied statement
-     * definition, if it is defined. This allows implementations of this
-     * interface add implicit parent to the build context hierarchy before a
-     * substatement is created.
+     * Returns implicit parent statement support for supplied statement definition, if it is defined. This allows
+     * implementations of this interface add implicit parent to the build context hierarchy before a substatement
+     * is created.
      *
      * @param stmtDef
      *            statement definition of substatement
      * @return optional of implicit parent statement support
      */
-    Optional<StatementSupport<?, ?, ?>> getImplicitParentFor(final StatementDefinition stmtDef);
+    Optional<StatementSupport<?, ?, ?>> getImplicitParentFor(StatementDefinition stmtDef);
 
     /**
-     * Invoked when statement is closed during
-     * {@link ModelProcessingPhase#SOURCE_PRE_LINKAGE} phase, only substatements
+     * Invoked when statement is closed during {@link ModelProcessingPhase#SOURCE_PRE_LINKAGE} phase, only substatements
      * from this and previous phase are available.
      *
-     * Implementation may use method to perform actions on this event or
-     * register modification action using
+     * <p>
+     * Implementation may use method to perform actions on this event or register modification action using
      * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
      *
      * @param stmt
@@ -114,12 +111,11 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     void onPreLinkageDeclared(StmtContext.Mutable<A, D, E> stmt);
 
     /**
-     * Invoked when statement is closed during
-     * {@link ModelProcessingPhase#SOURCE_LINKAGE} phase, only substatements
+     * Invoked when statement is closed during {@link ModelProcessingPhase#SOURCE_LINKAGE} phase, only substatements
      * from this and previous phase are available.
      *
-     * Implementation may use method to perform actions on this event or
-     * register modification action using
+     * <p>
+     * Implementation may use method to perform actions on this event or register modification action using
      * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
      *
      * @param stmt
@@ -130,12 +126,11 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     void onLinkageDeclared(StmtContext.Mutable<A, D, E> stmt);
 
     /**
-     * Invoked when statement is closed during
-     * {@link ModelProcessingPhase#STATEMENT_DEFINITION} phase, only
-     * substatements from this phase are available.
+     * Invoked when statement is closed during {@link ModelProcessingPhase#STATEMENT_DEFINITION} phase,
+     * only substatements from this phase are available.
      *
-     * Implementation may use method to perform actions on this event or
-     * register modification action using
+     * <p>
+     * Implementation may use method to perform actions on this event or register modification action using
      * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
      *
      * @param stmt
@@ -147,18 +142,13 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     void onStatementDefinitionDeclared(StmtContext.Mutable<A, D, E> stmt);
 
     /**
-     * Invoked when statement is closed during
-     * {@link ModelProcessingPhase#FULL_DECLARATION} phase.
+     * Invoked when statement is closed during {@link ModelProcessingPhase#FULL_DECLARATION} phase,
+     * only substatements from this phase are available.
      *
-     * Invoked when statement is closed during
-     * {@link ModelProcessingPhase#FULL_DECLARATION} phase, only substatements
-     * from this phase are available.
-     *
-     * Implementation may use method to perform actions on this event or
-     * register modification action using
+     * <p>
+     * Implementation may use method to perform actions on this event or register modification action using
      * {@link StmtContext.Mutable#newInferenceAction(ModelProcessingPhase)}.
      *
-     *
      * @param stmt
      *            Context of added statement. Argument and statement parent is
      *            accessible.
@@ -173,9 +163,8 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     boolean hasArgumentSpecificSupports();
 
     /**
-     * If this support has argument specific supports, the method returns
-     * support specific for given argument (e.g. type statement support need to
-     * be specialized based on its argument), otherwise returns null.
+     * If this support has argument specific supports, the method returns support specific for given argument
+     * (e.g. type statement support need to be specialized based on its argument), otherwise returns null.
      *
      * @param argument
      *            argument of statement
@@ -185,7 +174,7 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     StatementSupport<?, ?, ?> getSupportSpecificForArgument(String argument);
 
     /**
-     * Given a raw string representation of an argument, try to use a shared representation
+     * Given a raw string representation of an argument, try to use a shared representation.
      *
      * @param rawArgument
      *            Argument string
@@ -196,8 +185,7 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     }
 
     /**
-     * Returns unknown statement form of a regular yang statement supplied as
-     * parameter to the method.
+     * Returns unknown statement form of a regular YANG statement supplied as a parameter to the method.
      *
      * @param yangStmtDef
      *            statement definition of a regular yang statement
@@ -209,10 +197,9 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     }
 
     /**
-     * Returns true if this statement support and all its substatements ignore
-     * if-feature statements (e.g. yang-data extension defined in
-     * https://tools.ietf.org/html/rfc8040#section-8). Default implementation
-     * returns false.
+     * Returns true if this statement support and all its substatements ignore if-feature statements (e.g. yang-data
+     * extension defined in <a href="https://tools.ietf.org/html/rfc8040#section-8">RFC 8040</a>). Default
+     * implementation returns false.
      *
      * @return true if this statement support ignores if-feature statements,
      *         otherwise false.
@@ -223,10 +210,9 @@ public interface StatementSupport<A, D extends DeclaredStatement<A>, E extends E
     }
 
     /**
-     * Returns true if this statement support and all its substatements ignore
-     * config statements (e.g. yang-data extension defined in
-     * https://tools.ietf.org/html/rfc8040#section-8). Default implementation
-     * returns false.
+     * Returns true if this statement support and all its substatements ignore config statements (e.g. yang-data
+     * extension defined in <a href="https://tools.ietf.org/html/rfc8040#section-8">RFC 8040</a>). Default
+     * implementation returns false.
      *
      * @return true if this statement support ignores config statements,
      *         otherwise false.
index 3d9c9375f92b03c265049ede136da8ecf30e2e3c..7fe7eb0b23bcc60ae5fa6b7256c2e8bc6da6f9bf 100644 (file)
@@ -45,7 +45,7 @@ public final class StatementSupportBundle implements Immutable, NamespaceBehavio
     }
 
     /**
-     * Returns statement definitions common for all versions
+     * Returns statement definitions common for all versions.
      *
      * @return map of common statement definitions
      */
@@ -54,8 +54,8 @@ public final class StatementSupportBundle implements Immutable, NamespaceBehavio
     }
 
     /**
-     * Returns statement definitions specific for requested version. Result of
-     * this method doesn't include common statement definitions.
+     * Returns statement definitions specific for requested version. Result of this method does nit include common
+     * statement definitions.
      *
      * @param version
      *            requested version
@@ -67,8 +67,8 @@ public final class StatementSupportBundle implements Immutable, NamespaceBehavio
     }
 
     /**
-     * Returns all version specific statement definitions. Result of this method
-     * doesn't include common statement definitions.
+     * Returns all version specific statement definitions. Result of this method does not include common statement
+     * definitions.
      *
      * @return table of all version specific statement definitions, it doesn't
      *         include common statement definitions.
@@ -101,10 +101,7 @@ public final class StatementSupportBundle implements Immutable, NamespaceBehavio
         if (potential != null) {
             Preconditions.checkState(namespace.equals(potential.getIdentifier()));
 
-            /*
-             * Safe cast, previous checkState checks equivalence of key from
-             * which type argument are derived
-             */
+            // Safe cast, previous checkState checks equivalence of key from which type argument are derived
             return (NamespaceBehaviour<K, V, N>) potential;
         }
         if (parent != null) {
@@ -180,6 +177,15 @@ public final class StatementSupportBundle implements Immutable, NamespaceBehavio
             return this;
         }
 
+        public <K, V, N extends IdentifierNamespace<K, V>> Builder addSupport(
+                final NamespaceBehaviour<K, V, N> namespaceSupport) {
+            final Class<N> identifier = namespaceSupport.getIdentifier();
+            Preconditions.checkState(!namespaces.containsKey(identifier));
+            Preconditions.checkState(!parent.hasNamespaceBehaviour(identifier));
+            namespaces.put(identifier, namespaceSupport);
+            return this;
+        }
+
         public Builder addVersionSpecificSupport(final YangVersion version,
                 final StatementSupport<?, ?, ?> definition) {
             Preconditions.checkNotNull(version);
@@ -199,15 +205,6 @@ public final class StatementSupportBundle implements Immutable, NamespaceBehavio
             return this;
         }
 
-        public <K, V, N extends IdentifierNamespace<K, V>> Builder addSupport(
-                final NamespaceBehaviour<K, V, N> namespaceSupport) {
-            final Class<N> identifier = namespaceSupport.getIdentifier();
-            Preconditions.checkState(!namespaces.containsKey(identifier));
-            Preconditions.checkState(!parent.hasNamespaceBehaviour(identifier));
-            namespaces.put(identifier, namespaceSupport);
-            return this;
-        }
-
         public Set<YangVersion> getSupportedVersions() {
             return supportedVersions;
         }
index f6bd7abf68febf83efaae0d5c78ac408ed2e11f1..0d3dba150b1dd43cc7e943b803d9897d31a1db32 100644 (file)
@@ -46,6 +46,8 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
     StmtContext<?, ?, ?> getParentContext();
 
     /**
+     * Return the statement argument in literal format.
+     *
      * @return raw statement argument string
      */
     @Nullable
@@ -109,7 +111,7 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
     D buildDeclared();
 
     /**
-     * Builds {@link EffectiveStatement} for statement context
+     * Builds {@link EffectiveStatement} for statement context.
      */
     E buildEffective();
 
@@ -195,7 +197,7 @@ public interface StmtContext<A, D extends DeclaredStatement<A>, E extends Effect
         @Nonnull ModelActionBuilder newInferenceAction(@Nonnull ModelProcessingPhase phase);
 
         /**
-         * adds statement to namespace map with the key
+         * Adds s statement to namespace map with a key.
          *
          * @param namespace
          *            {@link StatementNamespace} child that determines namespace to be added to
index 984c9e3eaba285ff026946486321eeba45d20ec4..4fed7f2bb579837a2cbc564902914ce692e5bfd0 100644 (file)
@@ -85,6 +85,22 @@ public final class StmtContextUtils {
         return null;
     }
 
+    @SafeVarargs
+    public static StmtContext<?, ?, ?> findFirstDeclaredSubstatement(final StmtContext<?, ?, ?> stmtContext,
+            int startIndex, final Class<? extends DeclaredStatement<?>>... types) {
+        if (startIndex >= types.length) {
+            return null;
+        }
+
+        for (final StmtContext<?, ?, ?> subStmtContext : stmtContext.declaredSubstatements()) {
+            if (producesDeclared(subStmtContext, types[startIndex])) {
+                return startIndex + 1 == types.length ? subStmtContext : findFirstDeclaredSubstatement(subStmtContext,
+                        ++startIndex, types);
+            }
+        }
+        return null;
+    }
+
     @SuppressWarnings("unchecked")
     public static <A, D extends DeclaredStatement<A>> Collection<StmtContext<A, D, ?>> findAllDeclaredSubstatements(
             final StmtContext<?, ?, ?> stmtContext, final Class<D> declaredType) {
@@ -147,22 +163,6 @@ public final class StmtContextUtils {
                 declaredType);
     }
 
-    @SafeVarargs
-    public static StmtContext<?, ?, ?> findFirstDeclaredSubstatement(final StmtContext<?, ?, ?> stmtContext,
-            int startIndex, final Class<? extends DeclaredStatement<?>>... types) {
-        if (startIndex >= types.length) {
-            return null;
-        }
-
-        for (final StmtContext<?, ?, ?> subStmtContext : stmtContext.declaredSubstatements()) {
-            if (producesDeclared(subStmtContext, types[startIndex])) {
-                return startIndex + 1 == types.length ? subStmtContext : findFirstDeclaredSubstatement(subStmtContext,
-                        ++startIndex, types);
-            }
-        }
-        return null;
-    }
-
     public static <D extends DeclaredStatement<?>> StmtContext<?, ?, ?> findFirstDeclaredSubstatementOnSublevel(
             final StmtContext<?, ?, ?> stmtContext, final Class<D> declaredType, int sublevel) {
         for (final StmtContext<?, ?, ?> subStmtContext : stmtContext.declaredSubstatements()) {
@@ -305,16 +305,16 @@ public final class StmtContextUtils {
             return false;
         }
         switch ((YangStmtMapping) stmtCtx.getPublicDefinition()) {
-        case LEAF:
-        case CHOICE:
-        case ANYXML:
-            return Boolean.TRUE.equals(firstSubstatementAttributeOf(stmtCtx, MandatoryStatement.class));
-        case LIST:
-        case LEAF_LIST:
-            final Integer minElements = firstSubstatementAttributeOf(stmtCtx, MinElementsStatement.class);
-            return minElements != null && minElements > 0;
-        default:
-            return false;
+            case LEAF:
+            case CHOICE:
+            case ANYXML:
+                return Boolean.TRUE.equals(firstSubstatementAttributeOf(stmtCtx, MandatoryStatement.class));
+            case LIST:
+            case LEAF_LIST:
+                final Integer minElements = firstSubstatementAttributeOf(stmtCtx, MinElementsStatement.class);
+                return minElements != null && minElements > 0;
+            default:
+                return false;
         }
     }
 
@@ -337,14 +337,13 @@ public final class StmtContextUtils {
     }
 
     /**
-     * Checks whether at least one ancestor of a StatementContext matches one
-     * from collection of statement definitions.
+     * Checks whether at least one ancestor of a StatementContext matches one from a collection of statement
+     * definitions.
      *
      * @param ctx
      *            StatementContext to be checked
      * @param ancestorTypes
      *            collection of statement definitions
-     *
      * @return true if at least one ancestor of a StatementContext matches one
      *         from collection of statement definitions, otherwise false.
      */
@@ -363,16 +362,16 @@ public final class StmtContextUtils {
     }
 
     /**
-     * Checks whether all of StmtContext's ancestors of specified type have a child of specified type
+     * Checks whether all of StmtContext's ancestors of specified type have a child of specified type.
      *
      * @param ctx StmtContext to be checked
      * @param ancestorType type of ancestor to search for
      * @param ancestorChildType type of child to search for in the specified ancestor type
-     *
      * @return true if all of StmtContext's ancestors of specified type have a child of specified type, otherwise false
      */
-    public static <A, D extends DeclaredStatement<A>> boolean hasAncestorOfTypeWithChildOfType(final StmtContext<?, ?, ?> ctx,
-            final StatementDefinition ancestorType, final StatementDefinition ancestorChildType) {
+    public static <A, D extends DeclaredStatement<A>> boolean hasAncestorOfTypeWithChildOfType(
+            final StmtContext<?, ?, ?> ctx, final StatementDefinition ancestorType,
+            final StatementDefinition ancestorChildType) {
         Preconditions.checkNotNull(ctx);
         Preconditions.checkNotNull(ancestorType);
         Preconditions.checkNotNull(ancestorChildType);
@@ -396,15 +395,13 @@ public final class StmtContextUtils {
     }
 
     /**
-     * Checks whether the parent of StmtContext is of specified type
+     * Checks whether the parent of StmtContext is of specified type.
      *
      * @param ctx
      *            StmtContext to be checked
      * @param parentType
      *            type of parent to check
-     *
-     * @return true if the parent of StmtContext is of specified type, otherwise
-     *         false
+     * @return true if the parent of StmtContext is of specified type, otherwise false
      */
     public static boolean hasParentOfType(final StmtContext<?, ?, ?> ctx, final StatementDefinition parentType) {
         Preconditions.checkNotNull(ctx);
@@ -418,6 +415,7 @@ public final class StmtContextUtils {
      * The context can either be a leaf which is defined directly in the substatements of a keyed list or a uses
      * statement defined in a keyed list (a uses statement may add leaves into the list).
      *
+     * <p>
      * If one of the list keys contains an if-feature or a when statement in YANG 1.1 model, an exception is thrown.
      *
      * @param ctx statement context to be validated
@@ -479,41 +477,40 @@ public final class StmtContextUtils {
         }
 
         String prefix;
-        QNameModule qNameModule = null;
+        QNameModule qnameModule = null;
         String localName = null;
 
         final String[] namesParts = value.split(":");
         switch (namesParts.length) {
-        case 1:
-            localName = namesParts[0];
-            qNameModule = StmtContextUtils.getRootModuleQName(ctx);
-            break;
-        default:
-            prefix = namesParts[0];
-            localName = namesParts[1];
-            qNameModule = StmtContextUtils.getModuleQNameByPrefix(ctx, prefix);
-            // in case of unknown statement argument, we're not going to parse it
-            if (qNameModule == null && isUnknownStatement(ctx)) {
-                localName = value;
-                qNameModule = StmtContextUtils.getRootModuleQName(ctx);
-            }
-            if (qNameModule == null
-                    && ctx.getCopyHistory().getLastOperation() == CopyType.ADDED_BY_AUGMENTATION) {
-                ctx = ctx.getOriginalCtx().orElse(null);
-                qNameModule = StmtContextUtils.getModuleQNameByPrefix(ctx, prefix);
-            }
-            break;
+            case 1:
+                localName = namesParts[0];
+                qnameModule = StmtContextUtils.getRootModuleQName(ctx);
+                break;
+            default:
+                prefix = namesParts[0];
+                localName = namesParts[1];
+                qnameModule = StmtContextUtils.getModuleQNameByPrefix(ctx, prefix);
+                // in case of unknown statement argument, we're not going to parse it
+                if (qnameModule == null && isUnknownStatement(ctx)) {
+                    localName = value;
+                    qnameModule = StmtContextUtils.getRootModuleQName(ctx);
+                }
+                if (qnameModule == null && ctx.getCopyHistory().getLastOperation() == CopyType.ADDED_BY_AUGMENTATION) {
+                    ctx = ctx.getOriginalCtx().orElse(null);
+                    qnameModule = StmtContextUtils.getModuleQNameByPrefix(ctx, prefix);
+                }
+                break;
         }
 
-        qNameModule = InferenceException.throwIfNull(qNameModule, ctx.getStatementSourceReference(),
+        qnameModule = InferenceException.throwIfNull(qnameModule, ctx.getStatementSourceReference(),
             "Cannot resolve QNameModule for '%s'", value);
 
         final QNameModule resultQNameModule;
-        if (qNameModule.getRevision() == null) {
-            resultQNameModule = QNameModule.create(qNameModule.getNamespace(), SimpleDateFormatUtil.DEFAULT_DATE_REV)
+        if (qnameModule.getRevision() == null) {
+            resultQNameModule = QNameModule.create(qnameModule.getNamespace(), SimpleDateFormatUtil.DEFAULT_DATE_REV)
                 .intern();
         } else {
-            resultQNameModule = qNameModule;
+            resultQNameModule = qnameModule;
         }
 
         return ctx.getFromNamespace(QNameCacheNamespace.class, QName.create(resultQNameModule, localName));
@@ -525,35 +522,35 @@ public final class StmtContextUtils {
         }
 
         final StmtContext<?, ?, ?> rootCtx = ctx.getRoot();
-        final QNameModule qNameModule;
+        final QNameModule qnameModule;
 
         if (producesDeclared(rootCtx, ModuleStatement.class)) {
-            qNameModule = rootCtx.getFromNamespace(ModuleCtxToModuleQName.class, rootCtx);
+            qnameModule = rootCtx.getFromNamespace(ModuleCtxToModuleQName.class, rootCtx);
         } else if (producesDeclared(rootCtx, SubmoduleStatement.class)) {
             final String belongsToModuleName = firstAttributeOf(rootCtx.declaredSubstatements(),
                 BelongsToStatement.class);
-            qNameModule = rootCtx.getFromNamespace(ModuleNameToModuleQName.class, belongsToModuleName);
+            qnameModule = rootCtx.getFromNamespace(ModuleNameToModuleQName.class, belongsToModuleName);
         } else {
-            qNameModule = null;
+            qnameModule = null;
         }
 
-        Preconditions.checkArgument(qNameModule != null, "Failed to look up root QNameModule for %s", ctx);
-        if (qNameModule.getRevision() != null) {
-            return qNameModule;
+        Preconditions.checkArgument(qnameModule != null, "Failed to look up root QNameModule for %s", ctx);
+        if (qnameModule.getRevision() != null) {
+            return qnameModule;
         }
 
-        return QNameModule.create(qNameModule.getNamespace(), SimpleDateFormatUtil.DEFAULT_DATE_REV).intern();
+        return QNameModule.create(qnameModule.getNamespace(), SimpleDateFormatUtil.DEFAULT_DATE_REV).intern();
     }
 
     public static QNameModule getModuleQNameByPrefix(final StmtContext<?, ?, ?> ctx, final String prefix) {
         final ModuleIdentifier modId = ctx.getRoot().getFromNamespace(ImpPrefixToModuleIdentifier.class, prefix);
-        final QNameModule qNameModule = ctx.getFromNamespace(ModuleIdentifierToModuleQName.class, modId);
+        final QNameModule qnameModule = ctx.getFromNamespace(ModuleIdentifierToModuleQName.class, modId);
 
-        if (qNameModule == null && producesDeclared(ctx.getRoot(), SubmoduleStatement.class)) {
+        if (qnameModule == null && producesDeclared(ctx.getRoot(), SubmoduleStatement.class)) {
             final String moduleName = ctx.getRoot().getFromNamespace(BelongsToPrefixToModuleName.class, prefix);
             return ctx.getFromNamespace(ModuleNameToModuleQName.class, moduleName);
         }
-        return qNameModule;
+        return qnameModule;
     }
 
     public static SourceIdentifier createSourceIdentifier(final StmtContext<?, ?, ?> root) {
@@ -574,12 +571,12 @@ public final class StmtContextUtils {
     public static Date getLatestRevision(final Iterable<? extends StmtContext<?, ?, ?>> subStmts) {
         Date revision = null;
         for (final StmtContext<?, ?, ?> subStmt : subStmts) {
-            if (subStmt.getPublicDefinition().getDeclaredRepresentationClass().isAssignableFrom(RevisionStatement
-                    .class)) {
+            if (subStmt.getPublicDefinition().getDeclaredRepresentationClass().isAssignableFrom(
+                    RevisionStatement.class)) {
                 if (revision == null && subStmt.getStatementArgument() != null) {
                     revision = (Date) subStmt.getStatementArgument();
-                } else if (subStmt.getStatementArgument() != null && ((Date) subStmt.getStatementArgument()).compareTo
-                        (revision) > 0) {
+                } else if (subStmt.getStatementArgument() != null
+                        && ((Date) subStmt.getStatementArgument()).compareTo(revision) > 0) {
                     revision = (Date) subStmt.getStatementArgument();
                 }
             }
index 2bacaa40af0f585a1f65b60d43c4b92872a7c950..c1d1a2a58655066edd078566dc15fb42036fcec3 100644 (file)
@@ -20,13 +20,15 @@ import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleQName;
 
 public final class SubstatementValidator {
     /**
+     * Shorthand for unlimited number of occurances.
+     *
      * @deprecated Deprecated since version 1.1.0. Use {@link Builder#addAny(StatementDefinition)},
      *             {@link Builder#addAtLeast(StatementDefinition, int)},
      *             {@link Builder#addMandatory(StatementDefinition)}, or
      *             {@link Builder#addMultiple(StatementDefinition)} instead.
      */
     @Deprecated
-    public final static int MAX = Integer.MAX_VALUE;
+    public static final int MAX = Integer.MAX_VALUE;
 
     private final Map<StatementDefinition, Cardinality> cardinalityMap;
     private final Map<StatementDefinition, Cardinality> mandatoryStatements;
@@ -55,56 +57,56 @@ public final class SubstatementValidator {
             this.currentStatement = currentStatement;
         }
 
-        private Builder add(final StatementDefinition d, final Cardinality c) {
-            cardinalityMap.put(d, c);
+        private Builder add(final StatementDefinition def, final Cardinality card) {
+            cardinalityMap.put(def, card);
             return this;
         }
 
-        public Builder add(final StatementDefinition d, final int min, final int max) {
+        public Builder add(final StatementDefinition def, final int min, final int max) {
             if (max == Integer.MAX_VALUE) {
-                return addAtLeast(d, min);
+                return addAtLeast(def, min);
             } else if (min == 0) {
-                return addAtMost(d, max);
+                return addAtMost(def, max);
             } else {
-                return add(d, new Cardinality(min, max));
+                return add(def, new Cardinality(min, max));
             }
         }
 
         // Equivalent to min .. Integer.MAX_VALUE
-        public Builder addAtLeast(final StatementDefinition d, final int min) {
+        public Builder addAtLeast(final StatementDefinition def, final int min) {
             switch (min) {
                 case 0:
-                    return addAny(d);
+                    return addAny(def);
                 case 1:
-                    return addMultiple(d);
+                    return addMultiple(def);
                 default:
-                    return add(d, new Cardinality(min, Integer.MAX_VALUE));
+                    return add(def, new Cardinality(min, Integer.MAX_VALUE));
             }
         }
 
         // Equivalent to 0 .. max
-        public Builder addAtMost(final StatementDefinition d, final int max) {
-            return max == Integer.MAX_VALUE ? addAny(d) : add(d, new Cardinality(0, max));
+        public Builder addAtMost(final StatementDefinition def, final int max) {
+            return max == Integer.MAX_VALUE ? addAny(def) : add(def, new Cardinality(0, max));
         }
 
         // Equivalent to 0 .. Integer.MAX_VALUE
-        public Builder addAny(final StatementDefinition d) {
-            return add(d, ZERO_MAX);
+        public Builder addAny(final StatementDefinition def) {
+            return add(def, ZERO_MAX);
         }
 
         // Equivalent to 1 .. 1
-        public Builder addMandatory(final StatementDefinition d) {
-            return add(d, ONE_ONE);
+        public Builder addMandatory(final StatementDefinition def) {
+            return add(def, ONE_ONE);
         }
 
         // Equivalent to 1 .. MAX
-        public Builder addMultiple(final StatementDefinition d) {
-            return add(d, ONE_MAX);
+        public Builder addMultiple(final StatementDefinition def) {
+            return add(def, ONE_MAX);
         }
 
         // Equivalent to 0 .. 1
-        public Builder addOptional(final StatementDefinition d) {
-            return add(d, ZERO_ONE);
+        public Builder addOptional(final StatementDefinition def) {
+            return add(def, ZERO_ONE);
         }
 
         public SubstatementValidator build() {
@@ -204,4 +206,4 @@ public final class SubstatementValidator {
             return value;
         }
     }
-}
\ No newline at end of file
+}
index e14c7790d22895089fa774fe16d8beecd24489cb..24d54e50760a5fc8725def0a71e9b8602c5ddf84 100644 (file)
@@ -15,12 +15,10 @@ import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 
 /**
- *
- * Source-specific mapping of prefixes to namespaces
- *
+ * Source-specific mapping of prefixes to namespaces.
  */
-public interface AnyxmlSchemaLocationNamespace
-        extends
-        IdentifierNamespace<StatementDefinition, Mutable<SchemaNodeIdentifier, UnknownStatement<SchemaNodeIdentifier>, EffectiveStatement<SchemaNodeIdentifier, UnknownStatement<SchemaNodeIdentifier>>>> {
+public interface AnyxmlSchemaLocationNamespace extends IdentifierNamespace<StatementDefinition,
+    Mutable<SchemaNodeIdentifier, UnknownStatement<SchemaNodeIdentifier>,
+        EffectiveStatement<SchemaNodeIdentifier, UnknownStatement<SchemaNodeIdentifier>>>> {
 
 }
index 964063f48092f85eb34d0b2043d6c74328dfbc07..b5450d9fe3bb1e5821a4f84765bb5a200d660e56 100644 (file)
@@ -12,8 +12,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
  * namespace key class for storing augment nodes which are going to be augmented as
- * shortHand case nodes into choice node
+ * shortHand case nodes into choice node.
  */
 public interface AugmentToChoiceNamespace extends IdentifierNamespace<StmtContext<?, ?, ?>, Boolean> {
 
-}
\ No newline at end of file
+}
index 99d2f5135f48177b33e438e53fd9d13e9ab22005..86c0d5c73a33dfc5cfa056069d719a4731d458d4 100644 (file)
@@ -11,7 +11,8 @@ import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ImportedNamespaceContext;
 
 /**
-* namespace key class for storing belongs-to statements in Yang model storage
-*/
+ * namespace key class for storing belongs-to statements in Yang model storage.
+ */
 public interface BelongsToModuleContext extends ImportedNamespaceContext<ModuleIdentifier> {
+
 }
index a28cf5a02b85519dea25471258b58953aa229354..1ac500d2b05eb339d57074bcfa0abf7eff9e3bf2 100644 (file)
@@ -5,18 +5,16 @@
  * 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.source;
 
 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Source-specific mapping of belongsTo prefixes to module identifiers.
- * This mapping allows source-specific context to correctly populate prefixes map for
- * actual parsing phase and eventually, resolve QName for any valid declared statement.
- *
+ * Source-specific mapping of belongsTo prefixes to module identifiers. This mapping allows source-specific context
+ * to correctly populate prefixes map for actual parsing phase and eventually, resolve QName for any valid declared
+ * statement.
  */
 public interface BelongsToPrefixToModuleIdentifier extends IdentifierNamespace<String, ModuleIdentifier> {
+
 }
index 7b012ff9517820329c3903e6620758ab5464c58d..054a7b99bf6b00b40ea4d365a0ce9875f16115d0 100644 (file)
@@ -10,11 +10,8 @@ package org.opendaylight.yangtools.yang.parser.spi.source;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Source-specific mapping of prefixes to namespaces
- *
+ * Source-specific mapping of prefixes to namespaces.
  */
 public interface BelongsToPrefixToModuleName extends IdentifierNamespace<String, String> {
 
-
 }
index 22ef73a8042a3ea709a696df3457a23c0dc9a8c2..3d340e0e69915ff786857a693927a81c31daca24 100644 (file)
@@ -10,59 +10,24 @@ package org.opendaylight.yangtools.yang.parser.spi.source;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
 
 /**
+ * Reference of statement source present in textual source format. Utility implementation
+ * of {@link StatementSourceReference} for textual sources, this is prefered {@link StatementSourceReference}
+ * for implementations of YANG / YIN statement stream sources.
  *
- * Reference of statement source present in textual source format
- *
- * Utility implementation of {@link StatementSourceReference} for textual sources,
- * this is prefered {@link StatementSourceReference} for implementations
- * of YANG / YIN statement stream sources.
- *
- *
- *  To create source reference use one of this static factories:
- *  <ul>
- *  <li>{@link #atPosition(String, int, int)} - provides most specific reference of statement location,
- *  this is most prefered since it provides most context to debug YANG model.
- *  </li>
- *  <li>{@link #atLine(String, int)}- provides source and line of statement location.
- *  </li>
- *  <li>{@link #inSource(String)} - least specific reference, should be used only if any of previous
- *  references are unable to create / derive from source.
- *  </li>
- *  </ul>
- *
+ * <p>
+ * To create source reference use one of this static factories:
+ * <ul>
+ * <li>{@link #atPosition(String, int, int)} - provides most specific reference of statement location,
+ * this is most prefered since it provides most context to debug YANG model.
+ * </li>
+ * <li>{@link #atLine(String, int)}- provides source and line of statement location.
+ * </li>
+ * <li>{@link #inSource(String)} - least specific reference, should be used only if any of previous
+ * references are unable to create / derive from source.
+ * </li>
+ * </ul>
  */
 public abstract class DeclarationInTextSource implements StatementSourceReference {
-
-    private final String sourceName;
-
-    DeclarationInTextSource(final String sourceName) {
-        this.sourceName = sourceName;
-    }
-
-    public String getSourceName() {
-        return sourceName;
-    }
-
-    @Override
-    public StatementSource getStatementSource() {
-        return StatementSource.DECLARATION;
-    }
-
-    @Override
-    public abstract String toString();
-
-    public static DeclarationInTextSource inSource(final String sourceName) {
-        return new InSource(sourceName);
-    }
-
-    public static DeclarationInTextSource atLine(final String sourceName, final int line) {
-        return new AtLine(sourceName, line);
-    }
-
-    public static DeclarationInTextSource atPosition(final String sourceName, final int line, final int position) {
-        return new AtPosition(sourceName, line,position);
-    }
-
     private static class InSource extends DeclarationInTextSource {
         InSource(final String sourceName) {
             super(sourceName);
@@ -75,7 +40,6 @@ public abstract class DeclarationInTextSource implements StatementSourceReferenc
     }
 
     private static class AtLine extends InSource {
-
         private final int line;
 
         AtLine(final String sourceName, final int line) {
@@ -88,13 +52,12 @@ public abstract class DeclarationInTextSource implements StatementSourceReferenc
             return getSourceName() + ':' + line;
         }
 
-        public int getLine() {
+        int getLine() {
             return line;
         }
     }
 
-    private static class AtPosition extends AtLine {
-
+    private static final class AtPosition extends AtLine {
         private final int character;
 
         AtPosition(final String sourceName, final int line, final int character) {
@@ -107,4 +70,34 @@ public abstract class DeclarationInTextSource implements StatementSourceReferenc
             return getSourceName() + ':' + getLine() + ':' + character;
         }
     }
+
+    private final String sourceName;
+
+    DeclarationInTextSource(final String sourceName) {
+        this.sourceName = sourceName;
+    }
+
+    public static DeclarationInTextSource inSource(final String sourceName) {
+        return new InSource(sourceName);
+    }
+
+    public static DeclarationInTextSource atLine(final String sourceName, final int line) {
+        return new AtLine(sourceName, line);
+    }
+
+    public static DeclarationInTextSource atPosition(final String sourceName, final int line, final int position) {
+        return new AtPosition(sourceName, line, position);
+    }
+
+    public String getSourceName() {
+        return sourceName;
+    }
+
+    @Override
+    public StatementSource getStatementSource() {
+        return StatementSource.DECLARATION;
+    }
+
+    @Override
+    public abstract String toString();
 }
index 843ed6adc524ddde01cfe28e756992220a09c33a..974249e35804cdfe31c349a6de5f577c2e35f2b6 100644 (file)
@@ -11,9 +11,8 @@ import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Source-specific mapping of prefixes to module identifiers
- *
+ * Source-specific mapping of prefixes to module identifiers.
  */
 public interface ImpPrefixToModuleIdentifier extends IdentifierNamespace<String, ModuleIdentifier> {
+
 }
index 1c11c36994da8eb3bbb07eee534c52b4125cd8da..6c074a7afcd29785dccc3531182ed7dee78cacf1 100644 (file)
@@ -11,9 +11,7 @@ import java.net.URI;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Pre-linkage source-specific mapping of prefixes to module namespaces
- *
+ * Pre-linkage source-specific mapping of prefixes to module namespaces.
  */
 public interface ImpPrefixToNamespace extends IdentifierNamespace<String, URI> {
 
index d167832ea86d48ded1a31392b4af81bcecf54d63..bb84ac9067e40698a43b5fb32a5da490b678e0ca 100644 (file)
@@ -12,9 +12,9 @@ import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Source-specific mapping of prefixes to module identifier with specified semantic version
+ * Source-specific mapping of prefixes to module identifier with specified semantic version.
  */
 @Beta
 public interface ImpPrefixToSemVerModuleIdentifier extends IdentifierNamespace<String, ModuleIdentifier> {
+
 }
index 34fd1da3bafa64520d722ca7bb84e637b3ba0b79..209fb004681065e23097ce9f25a59f6ae9b719c6 100644 (file)
@@ -8,13 +8,10 @@
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
-
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Source-specific mapping of prefixes to namespaces
- *
+ * Source-specific mapping of prefixes to namespaces.
  */
 public interface IncludedSubmoduleNameToIdentifier extends IdentifierNamespace<String, ModuleIdentifier> {
 
index 29e2d9a210db29bed021d0835f2d62cd79b2bd75..bf521651696599da75d6b043f2d0567c7e0f9448 100644 (file)
@@ -12,10 +12,8 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
- *
- * Global mapping of modules to module identifier
- *
+ * Global mapping of modules to module identifier.
  */
-public interface ModuleCtxToModuleIdentifier extends IdentifierNamespace<StmtContext<?,?,?>, ModuleIdentifier> {
+public interface ModuleCtxToModuleIdentifier extends IdentifierNamespace<StmtContext<?, ?, ?>, ModuleIdentifier> {
 
 }
index 5e118b3de40a9fe9924372fe4abef4f17306ff0c..4360e8e3fe1218797b9476a35f9c4b4ce9aa3b3a 100644 (file)
@@ -12,9 +12,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 /**
- *
- * Global mapping of modules to QNameModules
- *
+ * Global mapping of modules to QNameModules.
  */
 public interface ModuleCtxToModuleQName extends IdentifierNamespace<StmtContext<?,?,?>, QNameModule> {
 
index efd62bec440d9cc80e031246a7972251edf737db..0107ced3a41a6c6a77fb3ead43fc44f1291a0b1a 100644 (file)
@@ -8,16 +8,12 @@
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
 import org.opendaylight.yangtools.yang.common.QNameModule;
-
 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Source-specific mapping of prefixes to namespaces
- *
+ * Source-specific mapping of prefixes to namespaces.
  */
 public interface ModuleIdentifierToModuleQName extends IdentifierNamespace<ModuleIdentifier, QNameModule> {
 
-
 }
index 33fc7d6aab1e487b768f272ea83bd8acdc7f910f..02d2ee854aebb52c52407325952d20656f6df0bf 100644 (file)
@@ -11,9 +11,7 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Source-specific mapping of prefixes to namespaces
- *
+ * Source-specific mapping of prefixes to namespaces.
  */
 public interface ModuleNameToModuleQName extends IdentifierNamespace<String, QNameModule> {
 
index e064c9d7c18fb073e9f4a82e91b05035e1d39342..dd60258fb473ba5794cbd1a965f043df8f867fd5 100644 (file)
@@ -11,9 +11,7 @@ import java.net.URI;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Pre-linkage global mapping of module names to namespaces
- *
+ * Pre-linkage global mapping of module names to namespaces.
  */
 public interface ModuleNameToNamespace extends IdentifierNamespace<String, URI> {
 
index 786a151aa4b4aaeb80911786107c29bd5487d6ab..f3af7fc0830fe35760e248e22531f42ab11f3578 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 
 /**
  * namespace class similar to {@link org.opendaylight.yangtools.yang.parser.spi.ModuleNamespace} for storing modules
- * into Yang model storage but keyed by plain name
+ * into Yang model storage but keyed by plain name.
  */
 public interface ModuleNamespaceForBelongsTo extends
         StatementNamespace<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
index cd45463e2c57e9885421c1ff65f27ede78c3b66a..7d7d9b4cc3c46bec12220b5c20cb2af6e528db70 100644 (file)
@@ -11,11 +11,8 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- *
- * Source-specific mapping of prefixes to namespaces
- *
+ * Source-specific mapping of prefixes to namespaces.
  */
-public interface ModuleQNameToModuleName extends IdentifierNamespace<QNameModule,String> {
-
+public interface ModuleQNameToModuleName extends IdentifierNamespace<QNameModule, String> {
 
 }
index 0298046db10dfb56dd6962860ee0dde21b5b7066..30a8a420e4c12b088ec74808e5d16d9b96da5fa9 100644 (file)
@@ -14,7 +14,7 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- * Source-specific mapping of prefixes to namespaces
+ * Source-specific mapping of prefixes to namespaces.
  */
 public interface PrefixToModule extends IdentifierNamespace<String, QNameModule> {
 
@@ -28,21 +28,18 @@ public interface PrefixToModule extends IdentifierNamespace<String, QNameModule>
      *            Prefix
      * @return QNameModule associated with supplied prefix, or null if prefix is
      *         not defined.
-     *
      */
     @Override
     @Nullable QNameModule get(@Nonnull String prefix);
 
     /**
-     * Returns QNameModule (namespace + revision) associated with XML namespace
-     * (URI).
+     * Returns QNameModule (namespace + revision) associated with XML namespace (URI).
      *
      * @param namespace
      *            XML Namespace
      * @return QNameModule associated with supplied namespace, or null if prefix
      *         is not defined.
      * @throws URISyntaxException if the input string is not valid URI
-     *
      */
     @Nullable QNameModule getByNamespace(String namespace) throws URISyntaxException;
 
@@ -50,7 +47,6 @@ public interface PrefixToModule extends IdentifierNamespace<String, QNameModule>
      * Pre-linkage map does not consider revision-dates of modules and it contains module namespaces only.
      *
      * @return true if it is the pre-linkage map.
-     *
      */
     boolean isPreLinkageMap();
 }
index d534df1007d7c0dda23d64eb120938590ed7a01b..26aab1aa08bf96ec9b4ac0d1ac720574e706db9d 100644 (file)
@@ -13,12 +13,13 @@ import java.util.HashMap;
 import java.util.Map;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+import javax.annotation.concurrent.NotThreadSafe;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 
+@NotThreadSafe
 public class PrefixToModuleMap implements PrefixToModule {
-
-    private Map<String, QNameModule> prefixToModuleMap = new HashMap<>();
-    private Map<URI, QNameModule> namespaceToModuleMap = new HashMap<>();
+    private final Map<String, QNameModule> prefixToModuleMap = new HashMap<>();
+    private final Map<URI, QNameModule> namespaceToModuleMap = new HashMap<>();
     private final boolean preLinkageMap;
 
     public PrefixToModuleMap() {
@@ -29,9 +30,9 @@ public class PrefixToModuleMap implements PrefixToModule {
         this.preLinkageMap = preLinkageMap;
     }
 
-    public void put(String prefix, QNameModule qNameModule) {
-        prefixToModuleMap.put(prefix, qNameModule);
-        namespaceToModuleMap.put(qNameModule.getNamespace(), qNameModule);
+    public void put(String prefix, QNameModule module) {
+        prefixToModuleMap.put(prefix, module);
+        namespaceToModuleMap.put(module.getNamespace(), module);
     }
 
     @Nullable
index e443d326064b33d0528881d93d3985b7bf60b049..23067a674acbd41c6f1e38dff6299827f0df6956 100644 (file)
@@ -15,12 +15,9 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
 
 /**
- *
  * Map of fully qualified statement name to statement definition.
- *
  */
 public interface QNameToStatementDefinition extends IdentifierNamespace<QName, StatementDefinition> {
-
     /**
      * Returns StatementDefinition with specified QName.
      *
@@ -41,5 +38,5 @@ public interface QNameToStatementDefinition extends IdentifierNamespace<QName, S
      * @return StatementDefinition
      */
     @Nullable
-    StatementDefinition getByNamespaceAndLocalName(@Nonnull final URI namespace, @Nonnull final String localName);
+    StatementDefinition getByNamespaceAndLocalName(@Nonnull URI namespace, @Nonnull String localName);
 }
index f0ac905a0f9582ba8f853ada3555607793563afc..3fbf513f5f055b88d476414d0288511719e47b4c 100644 (file)
@@ -76,7 +76,8 @@ public class QNameToStatementDefinitionMap implements QNameToStatementDefinition
 
     @Nullable
     @Override
-    public StatementDefinition getByNamespaceAndLocalName(@Nonnull final URI namespace, @Nonnull final String localName) {
+    public StatementDefinition getByNamespaceAndLocalName(@Nonnull final URI namespace,
+            @Nonnull final String localName) {
         return noRevQNameToSupport.get(QName.create(namespace, null, localName));
     }
 
index b5efed69b2b2c4a5d71e360d38b273268f7a5055..f686149439a4e4c1a843f8da877c26eca406f995 100644 (file)
@@ -10,32 +10,27 @@ package org.opendaylight.yangtools.yang.parser.spi.source;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
 
 /**
+ * Reference of statement source. Statement source reference serves to provide information, why a statement was defined
+ * and introduced in model.
  *
- * Reference of statement source
- *
- * Statement source reference serves to provide information, why
- * statement was defined and introduced in model.
- *
- * Reasons for introduction of statement could be various, but
- * most obvious one is explicit declaration in model source text
- * such as {@link DeclarationInTextSource}.
- *
+ * <p>
+ * Reasons for introduction of statement could be various, but most obvious one is explicit declaration in model source
+ * text such as {@link DeclarationInTextSource}.
  */
 public interface StatementSourceReference {
-
     /**
-     *
-     * Returns source type
+     * Returns source type.
      *
      * @return {@link StatementSource#DECLARATION} if statement was explicitly
-     * declared in YANG model source, {@link StatementSource#CONTEXT} if statement
-     * was inferred.
+     *         declared in YANG model source, {@link StatementSource#CONTEXT} if statement
+     *         was inferred.
      */
     StatementSource getStatementSource();
 
     /**
      * Returns human readable representation of statement source.
      *
+     * <p>
      * Implementations of this interface should override {@link #toString()},
      * since it may be used in error reporting to provide context
      * information for model designer to debug errors in its mode.
@@ -44,5 +39,4 @@ public interface StatementSourceReference {
      */
     @Override
     String toString();
-
 }
index 25107e6a707f77c5c2c6d15cb1f6d31204889bcd..11aa6b9e08241fe67fa4173979cc9c225a25eb47 100644 (file)
@@ -9,23 +9,21 @@ package org.opendaylight.yangtools.yang.parser.spi.source;
 
 import org.opendaylight.yangtools.yang.common.YangVersion;
 
-
 /**
- *
  * Statement stream source, which is used for inference of effective model.
  *
  * <p>
  * Statement stream source is required to emit its statements using supplied
  * {@link StatementWriter}.
- * </p>
+ *
  * <p>
  * Since YANG allows language extensions defined in sources (which defines how
  * source is serialized), instances of extensions present anywhere and forward
  * references, each source needs to be processed in three steps, where each step
  * uses different set of supported statements.
+ *
  * <p>
  * Steps (in order of invocation) are:
- *
  * <ol>
  * <li>{@link #writePreLinkage(StatementWriter, QNameToStatementDefinition)} -
  * Source MUST emit only statements related in pre-linkage, which are present in
@@ -50,30 +48,26 @@ import org.opendaylight.yangtools.yang.common.YangVersion;
  * - Source MUST emit all statements present in source. This step is used to
  * build full declared statement model of source.</li>
  * </ol>
- *
  */
 public interface StatementStreamSource {
 
     /**
-    *
-    * Emits only pre-linkage-related statements to supplied {@code writer}.
-    *
-    * @param writer
-    *            {@link StatementWriter} which should be used to emit
-    *            statements.
-    * @param stmtDef
-    *            Map of available statement definitions. Only these statements
-    *            may be written to statement writer, source MUST ignore and MUST NOT
-    *            emit any other statements.
-    *
-    * @throws SourceException
-    *             If source was is not valid, or provided statement writer
-    *             failed to write statements.
-    */
-    void writePreLinkage(StatementWriter writer, QNameToStatementDefinition stmtDef) throws SourceException;
+     * Emits only pre-linkage-related statements to supplied {@code writer}.
+     *
+     * @param writer
+     *            {@link StatementWriter} which should be used to emit
+     *            statements.
+     * @param stmtDef
+     *            Map of available statement definitions. Only these statements
+     *            may be written to statement writer, source MUST ignore and MUST NOT
+     *            emit any other statements.
+     * @throws SourceException
+     *             If source was is not valid, or provided statement writer
+     *             failed to write statements.
+     */
+    void writePreLinkage(StatementWriter writer, QNameToStatementDefinition stmtDef);
 
     /**
-     *
      * Emits only linkage-related statements to supplied {@code writer}.
      *
      * @param writer
@@ -85,18 +79,15 @@ public interface StatementStreamSource {
      *            emit any other statements.
      * @param preLinkagePrefixes
      *            Pre-linkage map of source-specific prefixes to namespaces
-     *
      * @throws SourceException
      *             If source was is not valid, or provided statement writer
      *             failed to write statements.
      */
-    void writeLinkage(StatementWriter writer, QNameToStatementDefinition stmtDef, PrefixToModule preLinkagePrefixes) throws SourceException;
+    void writeLinkage(StatementWriter writer, QNameToStatementDefinition stmtDef, PrefixToModule preLinkagePrefixes);
 
     /**
-     *
-     * Emits only linkage-related statements to supplied {@code writer} based on
-     * specified yang version. Default implementation does not make any
-     * differences between versions.
+     * Emits only linkage-related statements to supplied {@code writer} based on specified YANG version.
+     * Default implementation does not make any differences between versions.
      *
      * @param writer
      *            {@link StatementWriter} which should be used to emit
@@ -109,7 +100,6 @@ public interface StatementStreamSource {
      *            Pre-linkage map of source-specific prefixes to namespaces
      * @param yangVersion
      *            yang version.
-     *
      * @throws SourceException
      *             If source was is not valid, or provided statement writer
      *             failed to write statements.
@@ -120,30 +110,26 @@ public interface StatementStreamSource {
     }
 
     /**
-     *
-     * Emits only linkage and language extension statements to supplied
-     * {@code writer}.
+     * Emits only linkage and language extension statements to supplied {@code writer}.
      *
      * @param writer
-     *            {@link StatementWriter} which should be used to emit
-     *            statements.
+     *            {@link StatementWriter} which should be used to emit statements.
      * @param stmtDef
      *            Map of available statement definitions. Only these statements
      *            may be written to statement writer, source MUST ignore and MUST NOT
      *            emit any other statements.
      * @param prefixes
      *            Map of source-specific prefixes to namespaces
-     *
      * @throws SourceException
      *             If source was is not valid, or provided statement writer
      *             failed to write statements.
      */
-    void writeLinkageAndStatementDefinitions(StatementWriter writer, QNameToStatementDefinition stmtDef, PrefixToModule prefixes) throws SourceException;
+    void writeLinkageAndStatementDefinitions(StatementWriter writer, QNameToStatementDefinition stmtDef,
+            PrefixToModule prefixes);
 
     /**
-     *
      * Emits only linkage and language extension statements to supplied
-     * {@code writer} based on specified yang version. Default implementation
+     * {@code writer} based on specified YANG version. Default implementation
      * does not make any differences between versions.
      *
      * @param writer
@@ -156,7 +142,7 @@ public interface StatementStreamSource {
      * @param prefixes
      *            Map of source-specific prefixes to namespaces
      * @param yangVersion
-     *            yang version.
+     *            YANG version.
      *
      * @throws SourceException
      *             If source was is not valid, or provided statement writer
@@ -168,9 +154,7 @@ public interface StatementStreamSource {
     }
 
     /**
-     *
-     * Emits every statements present in this statement source to supplied
-     * {@code writer}.
+     * Emits every statements present in this statement source to supplied {@code writer}.
      *
      * @param writer
      *            {@link StatementWriter} which should be used to emit
@@ -183,10 +167,9 @@ public interface StatementStreamSource {
      *             If source was is not valid, or provided statement writer
      *             failed to write statements.
      */
-    void writeFull(StatementWriter writer,QNameToStatementDefinition stmtDef, PrefixToModule prefixes) throws SourceException;
+    void writeFull(StatementWriter writer,QNameToStatementDefinition stmtDef, PrefixToModule prefixes);
 
     /**
-     *
      * Emits every statements present in this statement source to supplied
      * {@code writer} based on specified yang version. Default implementation
      * does not make any differences between versions.
index d87f4d7444605ee801260c1b8c8fad12d5ef1832..3a876938ebe2e6275271b732421a9bc2e0cd05b8 100644 (file)
@@ -13,25 +13,20 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
 
 public interface StatementWriter {
-
     /**
-     *
      * Starts statement with supplied name and location in source.
      *
-     *
      * <p>
      * Each started statement must also be closed by
      * {@link #endStatement(StatementSourceReference)} in order for stream to be
      * correct.
-     * </p>
+     *
      * <p>
      * If statement has substatements, in order to start substatement, call to
-     * {@link #startStatement(int, QName, String, StatementSourceReference)} needs to be done
-     * for substatement.
+     * {@link #startStatement(int, QName, String, StatementSourceReference)} needs to be done for substatement.
      *
      * @param childId
      *            Child identifier, unique among siblings
-     *
      * @param name
      *            Fully qualified name of statement.
      * @param argument
@@ -42,7 +37,7 @@ public interface StatementWriter {
      * @throws SourceException
      *             if statement is not valid according to current context.
      */
-    void startStatement(final int childId, @Nonnull QName name, @Nullable String argument,
+    void startStatement(int childId, @Nonnull QName name, @Nullable String argument,
             @Nonnull StatementSourceReference ref);
 
     /**
@@ -55,9 +50,10 @@ public interface StatementWriter {
      *             if closed statement is not valid in current context, or there
      *             is no such statement
      */
-    void endStatement(@Nonnull StatementSourceReference ref) throws SourceException;
+    void endStatement(@Nonnull StatementSourceReference ref);
 
     /**
+     * Return current model processing phase.
      *
      * @return current processing phase
      */
index 8deb87e30b1608d096c1805ab6cce076b3fc39cd..e2f5b0fcf373aedb38832ebd5bb5584900a14eea 100644 (file)
@@ -12,36 +12,36 @@ import java.util.Collection;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 
 /**
- * namespace used for validating whether a node is of some type, e.g. usable target for some operation or has other
- * significant properties
+ * Namespace used for validating whether a node is of some type, e.g. usable target for some operation or has other
+ * significant properties.
  */
 public interface ValidationBundlesNamespace extends
         IdentifierNamespace<ValidationBundlesNamespace.ValidationBundleType, Collection<?>> {
 
-    public enum ValidationBundleType {
+    enum ValidationBundleType {
         /**
-         * whether a node is suitable refine substatement
+         * Whether a node is suitable refine substatement.
          */
         SUPPORTED_REFINE_SUBSTATEMENTS,
 
         /**
-         * whether a node is suitable target for refine operation
+         * Whether a node is suitable target for refine operation.
          */
         SUPPORTED_REFINE_TARGETS,
 
         /**
-         * whether a node is suitable target for augment operation
+         * Whether a node is suitable target for augment operation.
          */
         SUPPORTED_AUGMENT_TARGETS,
 
         /**
-         * whether a <a href="https://tools.ietf.org/html/rfc6020#section-7.9.2">case shorthand</a> can be created for a
-         * node
+         * Whether a <a href="https://tools.ietf.org/html/rfc6020#section-7.9.2">case shorthand</a> can be created for a
+         * node.
          */
         SUPPORTED_CASE_SHORTHANDS,
 
         /**
-         * whether a node is data node
+         * Whether a node is data node.
          */
         SUPPORTED_DATA_NODES
     }