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>
</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
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>> {
}
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>> {
}
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>> {
}
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>> {
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>> {
*/
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>> {
}
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>> {
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<?>>> {
}
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>> {
}
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> {
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
}
/**
- * {@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) {
}
/**
- * {@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) {
}
/**
- * {@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) {
}
/**
- * {@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) {
}
/**
- * 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
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.
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<?, ?, ?>>> {
}
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);
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.
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;
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);
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);
}
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}.
* 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.
* </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 {
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,
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;
}
*/
@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.
*
@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) {
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
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
StmtContext<?, ?, ? extends E> stmt);
/**
+ * Create a requirement on specified statement to become effective.
+ *
* @deprecated Undocumented method. Use at your own risk.
*/
@Deprecated
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
K key);
/**
+ * Mark the fact that this action is mutating a namespace.
+ *
* @deprecated Undocumented method. Use at your own risk.
*/
@Deprecated
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),
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)}.
*
public interface NamespaceStorageNode {
/**
+ * Return local namespace behaviour type.
+ *
* @return local namespace behaviour type {@link NamespaceBehaviour}
*/
StorageNodeType getStorageNodeType();
}
/**
- *
- * 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(
}
/**
- *
- * 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(
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
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);
}
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);
}
}
- 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();
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 {
* 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<?, ?, ?>>> {
+
}
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> {
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.
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
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
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
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.
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
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
}
/**
- * 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
}
/**
- * 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.
}
/**
- * 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.
}
/**
- * Returns statement definitions common for all versions
+ * Returns statement definitions common for all versions.
*
* @return map of common statement definitions
*/
}
/**
- * 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
}
/**
- * 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.
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) {
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);
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;
}
StmtContext<?, ?, ?> getParentContext();
/**
+ * Return the statement argument in literal format.
+ *
* @return raw statement argument string
*/
@Nullable
D buildDeclared();
/**
- * Builds {@link EffectiveStatement} for statement context
+ * Builds {@link EffectiveStatement} for statement context.
*/
E buildEffective();
@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
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) {
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()) {
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;
}
}
}
/**
- * 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.
*/
}
/**
- * 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);
}
/**
- * 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);
* 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
}
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));
}
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) {
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();
}
}
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;
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() {
return value;
}
}
-}
\ No newline at end of file
+}
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>>>> {
}
/**
* 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
+}
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> {
+
}
* 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> {
+
}
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> {
-
}
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);
}
private static class AtLine extends InSource {
-
private final int line;
AtLine(final String sourceName, final int line) {
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) {
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();
}
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> {
+
}
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> {
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> {
+
}
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> {
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> {
}
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> {
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> {
-
}
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> {
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> {
/**
* 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>> {
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> {
}
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> {
* 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;
* 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();
}
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() {
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
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.
*
* @return StatementDefinition
*/
@Nullable
- StatementDefinition getByNamespaceAndLocalName(@Nonnull final URI namespace, @Nonnull final String localName);
+ StatementDefinition getByNamespaceAndLocalName(@Nonnull URI namespace, @Nonnull String localName);
}
@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));
}
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.
*/
@Override
String toString();
-
}
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
* - 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
* 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
* 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.
}
/**
- *
- * 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
* @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
}
/**
- *
- * 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
* 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.
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
* @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);
/**
* 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
*/
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
}