X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-model-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fmodel%2Fapi%2FModule.java;h=0355ca5f3771aa63a19615027e6fb91e2290528b;hb=0b3eb607dc40ba586df1f6b8304e46d1b9c6e38a;hp=0da03eb986d914797343a4b973fe7b49af3bb2f3;hpb=9bd760d3fffdaca67bfcdf9d3202a6870830006d;p=yangtools.git diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Module.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Module.java index 0da03eb986..0355ca5f37 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Module.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Module.java @@ -7,213 +7,160 @@ */ package org.opendaylight.yangtools.yang.model.api; +import java.net.URI; import java.util.List; +import java.util.Optional; import java.util.Set; -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.
- *
- * Example of YANG module
- * {@link #getName() module} module_name{
-   {@link #getYangVersion() yang-version} "1";

- -   {@link #getNamespace() namespace} "urn:module:namespace";
-   {@link #getPrefix() prefix} "prefix";

- -   {@link #getDescription() description} "description test";
-   {@link #getReference() reference} "reference test";

- -   {@link #getOrganization() organization} "John Doe, john.doe@email.com";
-   {@link #getContact() contact} "http://www.opendaylight.org/";

- -   {@link #getFeatures() feature} feature-test{
-      description "description of some feature";
-   }
- -   {@link #getNotifications() notification} notification-test;
-   {@link #getRpcs() rpc} rpc-test;
- -   {@link #getIdentities() identity} identity-test;
-   {@link #getExtensionSchemaNodes() extension} extension-test;
- - -   {@link #getRevision() revision} 2011-08-27 {
- -   {@link #getImports() import} other_module {
-     prefix "other_module_prefix"
-     revision-date 2011-08-27
-   }

+ * This interface contains the methods for getting the data from the YANG module. + */ +public interface Module extends DataNodeContainer, DocumentedNode, Immutable, NotificationNodeContainer, + NamespaceRevisionAware { + /** + * 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(); -   container cont {
-   }
+ /** + * Returns a {@link QNameModule}, which contains the namespace and the revision of the module. + * + * @return QNameModule identifier. + */ + QNameModule getQNameModule(); -   {@link #getAugmentations() augment} "/cont" { ;
-   }
+ /** + * 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(); } -
- */ -@Immutable -public interface Module extends DataNodeContainer, SourceStreamAware, ModuleIdentifier { /** - * Returns the prefix of the module + * Returns the revision date for the module. If you need both namespace and + * revision, please consider using {@link #getQNameModule()}. * - * @return string with the module prefix which is specified as argument of - * YANG {@link Module prefix} - * keyword + * @return date of the module revision which is specified as argument of YANG {@code revison} statement */ - String getPrefix(); + @Override + default Optional getRevision() { + return getQNameModule().getRevision(); + } /** - * Returns the YANG version. + * Returns the semantic version of YANG module. If the semantic version is not specified, default semantic version + * of module is returned. * - * Default value is 1. - * - * @return string with the module YANG version which is specified as - * argument of YANG {@link Module yang-version} keyword + * @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 */ - String getYangVersion(); + Optional getSemanticVersion(); /** - * Returns the module description. + * Returns the prefix of the module. * - * @return string with the module description which is specified as argument - * of YANG {@link Module description} keyword + * @return string with the module prefix which is specified as argument of YANG {@code prefix} statement */ - String getDescription(); + String getPrefix(); /** - * Returns the module reference. + * Returns the YANG version. * - * @return string with the module reference which is specified as argument - * of YANG {@link Module reference} keyword + * @return YANG version of this module. */ - String getReference(); + YangVersion getYangVersion(); /** * Returns the module organization. * - * @return string with the name of the organization specified in the module - * as the argument of YANG {@link Module organization} keyword + * @return string with the name of the organization specified in the module as the argument of YANG + * {@code organization} statement */ - String getOrganization(); + Optional getOrganization(); /** * Returns the module contact. * - * 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 contact} keyword + * @return string with the contact data specified in the module as the argument of YANG {@code contact} statement */ - String getContact(); + Optional getContact(); /** - * Returns imports which represents YANG modules which are imported to this - * module via import 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 import} keywords. + * @return set of module imports which are specified in the module as the argument of YANG {@code import} + * statements. */ Set getImports(); Set getSubmodules(); /** - * Returns FeatureDefinition instances which contain data from - * feature statements defined in the module. + * Returns {@link FeatureDefinition} instances which contain data from {@code feature} statements defined in the + * module. * - * 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 feature} keywords. + * @return feature statements in lexicographical order which are specified in the module as the argument of YANG + * {@code feature} statements. */ Set getFeatures(); /** - * Returns NotificationDefinition instances which contain data - * from notification statements defined in the module. - * - * @return notification statements in lexicographical order which are - * specified in the module as the argument of YANG {@link Module - * notification} keywords. - */ - Set getNotifications(); - - /** - * Returns AugmentationSchema instances which contain data from - * augment 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 augment} 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 getAugmentations(); + Set getAugmentations(); /** - * Returns RpcDefinition instances which contain data from - * rpc 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 rpc} 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 getRpcs(); /** - * Returns Deviation instances which contain data from - * deviation 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 getDeviations(); /** - * Returns IdentitySchemaNode instances which contain data from - * identity 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 identity} 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 getIdentities(); /** - * Returns ExtensionDefinition instances which contain data - * from extension 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 extension} 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 getExtensionSchemaNodes(); - - /** - * Returns unknown nodes defined in module. - * - * @return unknown nodes in lexicographical order - */ - List getUnknownSchemaNodes(); - - /** - * Get yang source. - */ - String getSource(); - }