Module Declarations
A module is a name-scoping construct in
IDL. It’s similar to packages in Java or LISP, or to
namespaces in C++. A module is declared with the
module
keyword, followed by an identifier for
the module, and then the body of the module, enclosed in braces:
// IDL
module identifier
{ ... };
Modules can contain IDL interface definitions, constants, or
user-defined types, such as typedef
s,
struct
s, unions, and enumerations.
Mapping Modules to Java
Modules in IDL are mapped to packages in Java, and nested modules are mapped to subpackages, with the innermost module being mapped to the rightmost sub-package. If we have the following interfaces and modules defined in IDL:
// IDL module util{ interface MatrixOps { ... }; module dbase { interface Query { ... }; }; };
the generated Java code includes an interface named
MatrixOps
, starting with this
package
statement:
// Java package util;
and another interface named Query
, with this
package
statement:
// Java package util.dbase;
Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.