Category: Parsing Values Using Patterns

  • Conditional Formatting 2 – Localization

    Output from the program: Click here to view code image Requested Locale: en_USArguments:[0.5]     Result: There are no bananas.Arguments:[1.5]     Result: There is only one banana.Arguments:[2.5, 2]  Result: There are 2 bananas. Requested Locale: es_ESArguments:[0.5]     Result: Ahí no hay plátanos.Arguments:[1.5]     Result: Ahí es solo un plátano.Arguments:[2.5, 2]  Result: Ahí son 2 plátanos.…

  • Automatic Modules – Java Module System

    Automatic Modules A plain JAR—that is, a JAR that does not have a module-info.class file in its top-level directory—defines an automatic module when placed on the module path. An automatic module has a module name which is determined according to the scheme described below. An automatic module can read all…

  • Bottom-Up Strategy for Code Migration – Java Module System

    Bottom-Up Strategy for Code Migration If all direct dependencies of a plain JAR are known to be modules, the plain JAR can be directly converted to an explicit module by declaring their dependencies and exports in a module declaration. This idea is embodied in the following algorithm, based on the…

  • Exploring Modules – Java Module System

    19.13 Exploring Modules This section provides an introduction to using the JDK tools to discover, explore, and analyze modular applications. Given the JARs main.jar, control.jar, view.jar, and model.jar for the adviceApp application in the mlib directory in Figure 19.14(c), p. 1188, we will use JDK tools to explore these archives…

  • Module Name – Java Module System

    Module Name A legal module name can consist of one or more (by convention, lowercase) legal identifiers separated by a . (dot), as in the case of a package name. Module names and package names are in different namespaces. From the context in which such a name occurs, the compiler…

  • Creating a Modular Application – Java Module System

    19.5 Creating a Modular Application After understanding the basic role of a module declaration, we can proceed to create a modular application. As support for Java modules is not quite up to par at present in integrated development environments (IDEs), we will use the command-line tools provided by the JDK.…

  • Creating the Source Files in the Exploded Modules – Java Module System

    Creating the Source Files in the Exploded Modules The classes that are in packages included in the modules are declared in their respective source files. Example 19.1 shows the source files for the adviceApp application. The source code of the AdviceModel.java file in the model module is shown at (1)…

  • Compiling and Running a Modular Application – Java Module System

    19.6 Compiling and Running a Modular Application Both the javac tool to compile Java source code and the java tool to launch an application include new command-line options to specifically support building of modular applications. When the javac tool or the java tool is called, initially a module resolution is…

  • Creating JAR Files – Java Module System

    19.7 Creating JAR Files A JAR (Java Archive) file is a convenient way of bundling and deploying Java executable code and any other resources that are required (e.g., image or audio files). A JAR file is created by using the jar tool. The jar command has many options, akin to…

  • Making the Case for Modules – Java Module System

    19.1 Making the Case for Modules We begin by briefly examining the issues that modules address and the benefits they provide. Stronger Encapsulation Modules in Java provide a new level of encapsulation above packages. Whereas a package encapsulates classes and interfaces, a module encapsulates a set of packages and any…