{"id":1461,"date":"2021-07-23T09:20:38","date_gmt":"2021-07-22T21:20:38","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1461"},"modified":"2021-09-28T13:58:29","modified_gmt":"2021-09-28T00:58:29","slug":"module-info-syntax","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1461","title":{"rendered":"Module-Info Syntax"},"content":{"rendered":"<pre><code class=\"language-java\">[open] module &lt;MODULE_NAME&gt; {\n    [[requires [transitive] &lt;MODULE_NAME&gt;;]\n    [exports &lt;PACKAGE&gt;[ to &lt;MODULE_NAME_1&gt;[,&lt;MODULE_NAME_2&gt;..,&lt;MODULE_NAME_N&gt;];]\n    [opens &lt;PACKAGE&gt;;]\n    [provides &lt;SERVICE&gt; with &lt;SERVICE_IMPLEMENTATION_1&gt;[,&lt;SERVICE_IMPLEMENTATION_2&gt;..,&lt;SERVICE_IMPLEMENTATION_N&gt;];]\n    [uses &lt;SERVICE&gt;;]]\n}<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th>Identifier<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>module<\/td>\n<td>The <em>module keyword<\/em> that holds the module directives.<\/td>\n<\/tr>\n<tr>\n<td>&lt;MODULE_NAME&gt;<\/td>\n<td>The <em>module identier<\/em>.<\/td>\n<\/tr>\n<tr>\n<td>&lt;PACKAGE&gt;<\/td>\n<td>The <em>package identifier<\/em>.<\/td>\n<\/tr>\n<tr>\n<td>requires<\/td>\n<td>The <em>requires<\/em> directive indicates that this module depends on another module. <a href=\"https:\/\/dzone.com\/articles\/java-9-modules-part-3-directives\">^1<\/a><\/td>\n<\/tr>\n<tr>\n<td>transitive<\/td>\n<td>The <em>transitive<\/em> directive indicates that the user of the current module will also requite another module that the current user will also have access into.<\/td>\n<\/tr>\n<tr>\n<td>exports<\/td>\n<td>The <em>exports<\/em> directive indicates which public types of the module's package are accessible to other modules. <a href=\"https:\/\/dzone.com\/articles\/java-9-modules-part-3-directives\">^1<\/a><\/td>\n<\/tr>\n<tr>\n<td>opens<\/td>\n<td>The <em>opens<\/em> directive also indicates which public types of the module's package are accessible to other modules. The difference between that and <em>exports<\/em> is that <em>opens<\/em> is not for compile time, only during runtime, while <em>exports<\/em> is for both compile time and runtime. The <em>opens<\/em> directive can typically be used when you want to allow other modules to use reflection for the types in the specified packages, but not to use them during compile time. Let's make this more clear by means of an example. <a href=\"https:\/\/dzone.com\/articles\/java-9-modules-part-3-directives\">^1<\/a><\/td>\n<\/tr>\n<tr>\n<td>open<\/td>\n<td>This is like the opens directive but with this it <em>opens the whole module<\/em>.<\/td>\n<\/tr>\n<tr>\n<td>to &lt;MODULE_NAME_1&gt;[, &lt;MODULE_NAME_2&gt;.., &lt;MODULE_NAME_N&gt;]<\/td>\n<td>This indicates to target just specific module(s).<\/td>\n<\/tr>\n<tr>\n<td>provides...with<\/td>\n<td>The <em>provides...with<\/em> directive indicates that the module provides a service implementation.<a href=\"https:\/\/dzone.com\/articles\/java-9-modules-part-3-directives\">^1<\/a><\/td>\n<\/tr>\n<tr>\n<td>uses<\/td>\n<td>The <em>uses<\/em> directive indicates that the module requires a service implementation.<\/td>\n<\/tr>\n<tr>\n<td>&lt;SERVICE&gt;<\/td>\n<td>The <em>interface or abstract class<\/em> that will be implemented as a service.<\/td>\n<\/tr>\n<tr>\n<td>&lt;SERVICE_IMPLEMENTATION_1&gt;[, &lt;SERVICE_IMPLEMENTATION_2&gt;.., &lt;SERVICE_IMPLEMENTATION_N&gt;]<\/td>\n<td>The <em>implementation class<\/em>es of the SERVICE_INTERFACE.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>[open] module &lt;MODULE_NAME&gt; { [[requires [transitive] &lt;MODULE_NAME&gt;;] [exports &lt;PACKAGE&gt;[ to &lt;MODULE_NAME_1&gt;[,&lt;MODULE_NAME_2&gt;..,&lt;MODULE_NAME_N&gt;];] [opens &lt;PACKAGE&gt;;] [provides &lt;SERVICE&gt; with &lt;SERVICE_IMPLEMENTATION_1&gt;[,&lt;SERVICE_IMPLEMENTATION_2&gt;..,&lt;SERVICE_IMPLEMENTATION_N&gt;];] [uses &lt;SERVICE&gt;;]] } Identifier Description module The module keyword that holds the module directives. &lt;MODULE_NAME&gt; The module identier. &lt;PACKAGE&gt; The package identifier. requires The requires directive indicates that this module depends on another module. ^1 transitive The transitive [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[43,71],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1461"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1461"}],"version-history":[{"count":4,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1461\/revisions"}],"predecessor-version":[{"id":1485,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1461\/revisions\/1485"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}