a module specified in the requires directive is 1 which exports packages that the current module may or does have a dependency on
The current module is set to be read the module specified in the required directive
A "requires directive" with the transitive modifier allows any module which requires the current module to have an implicit requires directive on the specified module
A static directive requires the specified module at compile time but it's optional at runtime.
The two keyword makes an exports directive qualified and will be followed by a comma delimited list of modules that are termed friends of the current module friends of a module have access to public and protected types and the public and protected members of those types of the exported package no other modules will have access you limit the exposure of the exported package types to its friends .
We are going to walk through each of these directives in IntelliJ.
org.module.global
Cut and paste the code for
public class ApplicationConstants {
Two methods, 1) addCounter 2) getCounter
We are going to expose this package to any other module that requires it. by changing the module-info.java file.
module org.module.global {
}
We are exposing this package to any other module that requires it.
Right mouse click on
Let us create a second module that will contain utility code.
Intellij wants us to include
org.module.global;
in its dependencies.
In the next video, we will implement the interface in a
1) separate class
2) separate Module.