package org.opendaylight.yangtools.yang.model.api;
import java.net.URI;
-import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
+import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.concepts.SemVer;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.common.YangVersion;
/**
- * This interface contains the methods for getting the data from the YANG
- * module.<br>
- * <br>
- * <i>Example of YANG module</i> <code><br>
- * {@link #getName() <b><font color="#FF0000">module</font></b>} module_name{<br>
- {@link #getYangVersion() <b><font color="#8b4513">yang-version</font></b>} "1";<br><br>
-
- {@link #getNamespace() <b><font color="#00FF00">namespace</font></b>} "urn:module:namespace";<br>
- {@link #getPrefix() <b><font color="#0000FF">prefix</font></b><a name="prefix"></a>} "prefix";<br><br>
-
- {@link #getDescription() <b><font color="#b8860b">description</font></b>} "description test";<br>
- {@link #getReference() <b><font color="#008b8b">reference</font></b>} "reference test";<br><br>
-
- {@link #getOrganization() <b><font color="#606060">organization</font></b>}
- "John Doe, john.doe@email.com";<br>
- {@link #getContact() <b><font color="#FF9900">contact</font></b>} "http://www.opendaylight.org/";<br>
- <br>
-
- {@link #getFeatures() <b><font color="#8b0000">feature</font></b>} feature-test{<br>
- description "description of some feature";<br>
- }<br>
-
- {@link #getNotifications() <b><font color="#b22222">notification</font></b>} notification-test;<br>
- {@link #getRpcs() <b><font color="#d2691e">rpc</font></b>} rpc-test;<br>
- <!-- {@link #getDeviations() <b><font color="#b8860b">deviation</font></b>} deviation-test;<br> -->
- {@link #getIdentities() <b><font color="#bdb76b">identity</font></b>} identity-test;<br>
- {@link #getExtensionSchemaNodes() <b><font color="#808000">extension</font></b>} extension-test;<br>
-
-
- {@link #getRevision() <b><font color="#339900">revision</font></b>} 2011-08-27 {<br>
-
- {@link #getImports() <b><font color="#9400d3">import</font></b>} other_module {<br>
- prefix "other_module_prefix"<br>
- revision-date 2011-08-27<br>
- }<br><br>
-
- container cont {<br>
- }<br>
-
- {@link #getAugmentations() <b><font color="#dc143c">augment</font></b>} "/cont" { ;<br>
- }<br>
- }
-
- </code>
+ * This interface contains the methods for getting the data from the YANG module.
*/
-@Immutable
-public interface Module extends DataNodeContainer, NotificationNodeContainer {
+public interface Module extends DataNodeContainer, DocumentedNode, Immutable, NotificationNodeContainer,
+ NamespaceRevisionAware {
/**
- * Returns the name of the module which is specified as argument of YANG
- * {@link Module <b><font color="#FF0000">module</font></b>} keyword.
+ * Returns the name of the module which is specified as argument of YANG {@code module} statement.
*
* @return string with the name of the module
*/
String getName();
/**
- * Returns a {@link QNameModule}, which contains the namespace and
- * the revision of the module.
+ * Returns a {@link QNameModule}, which contains the namespace and the revision of the module.
*
* @return QNameModule identifier.
*/
QNameModule getQNameModule();
/**
- * Returns the namespace of the module which is specified as argument of
- * YANG {@link Module <b><font color="#00FF00">namespace</font></b>}
- * keyword. If you need both namespace and revision, please consider using
- * {@link #getQNameModule()}.
+ * Returns the namespace of the module which is specified as argument of YANG {@code namespace}
+ * keyword. If you need both namespace and revision, please consider using {@link #getQNameModule()}.
*
* @return URI format of the namespace of the module
*/
+ @Override
default URI getNamespace() {
return getQNameModule().getNamespace();
}
* Returns the revision date for the module. If you need both namespace and
* revision, please consider using {@link #getQNameModule()}.
*
- * @return date of the module revision which is specified as argument of
- * YANG {@link Module <b><font color="#339900">revison</font></b>}
- * keyword
+ * @return date of the module revision which is specified as argument of YANG {@code revison} statement
*/
- // FIXME: BUG-4688: should return Optional<Revision>
- @Nullable default Date getRevision() {
+ @Override
+ default Optional<Revision> getRevision() {
return getQNameModule().getRevision();
}
/**
- * Returns the semantic version of yang module.
- *
- * <p>
- * If the semantic version is not specified, default semantic version of
- * module is returned.
+ * Returns the semantic version of YANG module. If the semantic version is not specified, default semantic version
+ * of module is returned.
*
- * @return SemVer semantic version of yang module which is specified as
- * argument of
- * (urn:opendaylight:yang:extension:semantic-version?revision
- * =2016-02-02)semantic-version statement
+ * @return SemVer semantic version of YANG module which is specified as argument of
+ * {@code (urn:opendaylight:yang:extension:semantic-version?revision=2016-02-02)semantic-version} statement
*/
Optional<SemVer> getSemanticVersion();
/**
* Returns the prefix of the module.
*
- * @return string with the module prefix which is specified as argument of
- * YANG {@link Module <b><font color="#0000FF">prefix</font></b>}
- * keyword
+ * @return string with the module prefix which is specified as argument of YANG {@code prefix} statement
*/
String getPrefix();
*/
YangVersion getYangVersion();
- /**
- * Returns the module description.
- *
- * @return string with the module description which is specified as argument
- * of YANG {@link Module <b><font
- * color="#b8860b">description</font></b>} keyword
- */
- String getDescription();
-
- /**
- * Returns the module reference.
- *
- * @return string with the module reference which is specified as argument
- * of YANG {@link Module <b><font
- * color="#008b8b">reference</font></b>} keyword
- */
- String getReference();
-
/**
* Returns the module organization.
*
- * @return string with the name of the organization specified in the module
- * as the argument of YANG {@link Module <b><font
- * color="#606060">organization</font></b>} keyword
+ * @return string with the name of the organization specified in the module as the argument of YANG
+ * {@code organization} statement
*/
- String getOrganization();
+ Optional<String> getOrganization();
/**
* Returns the module contact.
*
* <p>
- * The contact represents the person or persons to whom technical queries
- * concerning this module should be sent, such as their name, postal
- * address, telephone number, and electronic mail address.
+ * The contact represents the person or persons to whom technical queries concerning this module should be sent,
+ * such as their name, postal address, telephone number, and electronic mail address.
*
- * @return string with the contact data specified in the module as the
- * argument of YANG {@link Module <b><font
- * color="#FF9900">contact</font></b>} keyword
+ * @return string with the contact data specified in the module as the argument of YANG {@code contact} statement
*/
- String getContact();
+ Optional<String> getContact();
/**
- * Returns imports which represents YANG modules which are imported to this
- * module via <b>import</b> statement.
+ * Returns imports which represents YANG modules which are imported to this module via {@code import} statement.
*
- * @return set of module imports which are specified in the module as the
- * argument of YANG {@link Module <b><font
- * color="#9400d3">import</font></b>} keywords.
+ * @return set of module imports which are specified in the module as the argument of YANG {@code import}
+ * statements.
*/
Set<ModuleImport> getImports();
Set<Module> getSubmodules();
/**
- * Returns <code>FeatureDefinition</code> instances which contain data from
- * <b>feature</b> statements defined in the module.
+ * Returns {@link FeatureDefinition} instances which contain data from {@code feature} statements defined in the
+ * module.
*
* <p>
- * The feature is used to define a mechanism by which portions of the schema
- * are marked as conditional.
+ * The feature is used to define a mechanism by which portions of the schema are marked as conditional.
*
- * @return feature statements in lexicographical order which are specified
- * in the module as the argument of YANG {@link Module <b><font
- * color="#8b0000">feature</font></b>} keywords.
+ * @return feature statements in lexicographical order which are specified in the module as the argument of YANG
+ * {@code feature} statements.
*/
Set<FeatureDefinition> getFeatures();
/**
- * Returns <code>AugmentationSchema</code> instances which contain data from
- * <b>augment</b> statements defined in the module.
+ * Returns {@link AugmentationSchemaNode} instances which contain data from {@code augment} statements defined
+ * in the module.
*
- * @return set of the augmentation schema instances which are specified in
- * the module as YANG {@link Module <b><font
- * color="#dc143c">augment</font></b>} keyword and are
- * lexicographically ordered
+ * @return set of the augmentation schema instances which are specified in the module as YANG {@code augment}
+ * statement and are lexicographically ordered
*/
- Set<AugmentationSchema> getAugmentations();
+ Set<AugmentationSchemaNode> getAugmentations();
/**
- * Returns <code>RpcDefinition</code> instances which contain data from
- * <b>rpc</b> statements defined in the module.
+ * Returns {@link RpcDefinition} instances which contain data from {@code rpc} statements defined in the module.
*
- * @return set of the rpc definition instances which are specified in the
- * module as YANG {@link Module <b><font
- * color="#d2691e">rpc</font></b>} keywords and are lexicographicaly
- * ordered
+ * @return set of the RPC definition instances which are specified in the module as YANG {@code rpc} statements and
+ * are lexicographicaly ordered
*/
Set<RpcDefinition> getRpcs();
/**
- * Returns <code>Deviation</code> instances which contain data from
- * <b>deviation</b> statements defined in the module.
+ * Returns {@link Deviation} instances which contain data from {@code deviation} statements defined in the module.
*
* @return set of the deviation instances
*/
Set<Deviation> getDeviations();
/**
- * Returns <code>IdentitySchemaNode</code> instances which contain data from
- * <b>identity</b> statements defined in the module.
+ * Returns {@link IdentitySchemaNode} instances which contain data from {@code identity} statements defined in the
+ * module.
*
- * @return set of identity schema node instances which are specified in the
- * module as YANG {@link Module <b><font
- * color="#bdb76b">identity</font></b>} keywords and are
- * lexicographically ordered
+ * @return set of identity schema node instances which are specified in the module as YANG {@code identity}
+ * statements and are lexicographically ordered
*/
Set<IdentitySchemaNode> getIdentities();
/**
- * Returns <code>ExtensionDefinition</code> instances which contain data
- * from <b>extension</b> statements defined in the module.
+ * Returns {@link ExtensionDefinition} instances which contain data from {@code extension} statements defined in
+ * the module.
*
- * @return set of extension definition instances which are specified in the
- * module as YANG {@link Module <b><font
- * color="#808000">extension</font></b>} keyword and are
- * lexicographically ordered
+ * @return set of extension definition instances which are specified in the module as YANG {@code extension}
+ * statements and are lexicographically ordered
*/
List<ExtensionDefinition> getExtensionSchemaNodes();
-
- /**
- * Returns unknown nodes defined in module.
- *
- * @return unknown nodes in lexicographical order
- */
- @Nonnull
- List<UnknownSchemaNode> getUnknownSchemaNodes();
}