API changes in yang-model-api.
Change-Id: Id8e2c294374b61e254fd0d023cda4e8071cc86d1
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
public interface DocumentedNode {
/**
- * Returns description of the instance of the type <code>SchemaNode</code>
+ * All implementations should override this method.
+ * The default definition of this method is used only in YANG 1.0 (RFC6020) implementations of
+ * ModuleImport which do not allow a description statement.
+ * YANG import statement has been changed in YANG 1.1 (RFC7950) and can now contain a description statement.
*
- * @return string with textual description the node which represents the
- * argument of the YANG <code>description</code> substatement
+ * @return string that represents the argument of description statement
*/
- @Nullable String getDescription();
-
- /**
- * Returns reference of the instance of the type <code>SchemaNode</code>
- *
- * The reference refers to external document that provides additional
- * information relevant for the instance of this type.
- *
- * @return string with the reference to some external document which
- * represents the argument of the YANG <code>reference</code>
- * substatement
- */
- @Nullable String getReference();
+ // FIXME: version 2.0.0: make this method non-default
+ @Nullable default String getDescription() {
+ return null;
+ }
/**
- * Returns status of the instance of the type <code>SchemaNode</code>
+ * All implementations should override this method.
+ * The default definition of this method is used only in YANG 1.0 (RFC6020) implementations of
+ * ModuleImport which do not allow a reference statement.
+ * YANG import statement has been changed in YANG 1.1 (RFC7950) and can now contain a reference statement.
*
- * @return status of this node which represents the argument of the YANG
- * <code>status</code> substatement
+ * @return string that represents the argument of reference statement
*/
- @Nonnull Status getStatus();
+ // FIXME: version 2.0.0: make this method non-default
+ @Nullable default String getReference() {
+ return null;
+ }
/**
* Returns unknown schema nodes which belongs to this instance.
default @Nonnull List<UnknownSchemaNode> getUnknownSchemaNodes() {
return ImmutableList.of();
}
+
+ interface WithStatus extends DocumentedNode {
+
+ /**
+ * Returns status of the instance of the type <code>SchemaNode</code>
+ *
+ * @return status of this node which represents the argument of the YANG
+ * <code>status</code> substatement
+ */
+ @Nonnull Status getStatus();
+ }
}
* another module or submodule.
* </p>
*/
-public interface ModuleImport {
+public interface ModuleImport extends DocumentedNode {
/**
* @return Name of the module to import
* @return Prefix used to point to imported module
*/
String getPrefix();
-
}
/**
* SchemaNode represents a node in schema tree.
*/
-public interface SchemaNode extends DocumentedNode {
+public interface SchemaNode extends DocumentedNode.WithStatus {
/**
* Returns QName of the instance of the type <code>SchemaNode</code>.
*
* <code>uses</code> substatement.
*
*/
-public interface UsesNode extends DocumentedNode {
+public interface UsesNode extends DocumentedNode.WithStatus {
/**
* Returns the schema path to used grouping.
public interface DocumentationGroup {
- @Nullable DescriptionStatement getDescription();
+ /**
+ * All implementations should override this method.
+ * The default definition of this method is used only in YANG 1.0 (RFC6020) implementations of
+ * ImportStatement and IncludeStatement which do not allow a description statement.
+ * These YANG statements have been changed in YANG 1.1 (RFC7950) and can now contain a description statement.
+ *
+ * @return description statement
+ */
+ // FIXME: version 2.0.0: make this method non-default
+ @Nullable default DescriptionStatement getDescription() {
+ return null;
+ }
- @Nullable ReferenceStatement getReference();
+ /**
+ * All implementations should override this method.
+ * The default definition of this method is used only in YANG 1.0 (RFC6020) implementations of
+ * ImportStatement and IncludeStatement which do not allow a reference statement.
+ * These YANG statements have been changed in YANG 1.1 (RFC7950) and can now contain a reference statement.
+ *
+ * @return reference statement
+ */
+ // FIXME: version 2.0.0: make this method non-default
+ @Nullable default ReferenceStatement getReference() {
+ return null;
+ }
interface WithStatus extends DocumentationGroup {
import javax.annotation.Nullable;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-public interface ImportStatement extends DeclaredStatement<String> {
+public interface ImportStatement extends DeclaredStatement<String>, DocumentationGroup {
@Nonnull String getModule();
import javax.annotation.Nullable;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-public interface IncludeStatement extends DeclaredStatement<String> {
+public interface IncludeStatement extends DeclaredStatement<String>, DocumentationGroup {
@Nonnull String getModule();
* Contains the methods for accessing the data about the concrete
* enumeration item which represents <code>enum</code> YANG type.
*/
- interface EnumPair extends DocumentedNode {
+ interface EnumPair extends DocumentedNode.WithStatus {
/**
* The name to specify each assigned name of an enumeration type.
*
}
}
- private void emitDocumentedNode(final DocumentedNode input) {
+ private void emitDocumentedNode(final DocumentedNode.WithStatus input) {
emitStatusNode(input.getStatus());
emitDescriptionNode(input.getDescription());
emitReferenceNode(input.getReference());
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
public abstract class AbstractEffectiveDocumentedNode<A, D extends DeclaredStatement<A>>
- extends DeclaredEffectiveStatementBase<A, D> implements DocumentedNode {
+ extends DeclaredEffectiveStatementBase<A, D> implements DocumentedNode.WithStatus {
private final String description;
private final String reference;