Book Home Java Enterprise in a Nutshell Search this book

10.9. Module Declarations

A module is a name-scoping construct in IDL. It is similar to a package in Java, or LISP or a namespace 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 typedefs, structs, unions, and enumerations.

10.9.1. 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 subpackage. Consider 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;


Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.