OOPortal 





IDL Constructed Types   «Prev  Next»
Lesson 1

Java mapping: Constructed types

This module discusses IDL-to-Java mapping by examining how IDL constructed types are mapped to Java and how the resulting generated Java code is used.
Module objectives
By the end of this module, you will be able to
  1. Describe how IDL structs, sequences, and enums map to Java
  2. Use the Java generated for structs, sequences, and enums
  3. Describe how IDL exceptions map to Java
  4. Use the Java generated for exceptions
  5. Describe how IDL unions and arrays map to Java
  6. Use the Java generated for unions and arrays
In the next lesson, you will learn the Java mapping for IDL structs.


  1. Write an Interface Definition Language (IDL) file that describes the remote object's interface
  2. Choose the programming language that you will use to implement the object
  3. Run the IDL compiler to generate language-specific implementation files, stubs and skeletons
  4. Code the implementation in chosen language
  5. Write a server main program that creates an instance of the implementation object and assigns the object a name
The IDL compiler translates IDL into stub and skeleton code for a given language, in this case, Java. As long as the client and server programs comply with the definitions in the generated stub and skeleton code, the runtime ORB enables type-safe interaction between the client and the server.
Example 2: Java Stub Code for the Building Interface
// File: Building.java
package BuildingExample;