Java IDL: IDL to Java Language Mapping


This release of the JavaTM 2 Platform Standard Edition 5.0, includes idlj, a compiler that reads an Object Management Group (OMG) Interface Definition Language (IDL) file and translates it, or maps it, to a Java interface. Depending on the command-line options used, the idlj compiler creates stub, skeleton, helper, holder, and other files as necessary. These .java files are generated from the IDL file according to the mapping specified in the OMG document (pdf format) OMG IDL to Java Language Mapping Specification, ptc, 00-01-08, with the revisions indicated in ptc/00-11-03, The new IDL to Java Mapping Chapter. Version 00-01-08 of the IDL to Java language mapping is aligned with CORBA version 2.3.2. For a basic summary of the IDL to Java mapping, see IDL to Java Language Mapping Overview below.

Some topics from the OMG IDL to Java Language Mapping specification that are not easily summarized are:


IDL to Java Language Mapping Overview

CORBA objects are defined in OMG IDL (Object Management Group Interface Definition Language). The syntax and semantics of OMG IDL are defined in Chapter 3 of the CORBA/IIOP 2.3.1 Specification. The IDL-to-Java compiler, idlj, maps the IDL-defined interfaces to Java classes and interfaces as defined in OMG IDL to Java Language Mapping Specification, ptc, 00-01-08, and as supported in this version of the Java platform, as described in Official Specifications for CORBA support in J2SE 5.0.

This overview shows the correspondence between OMG IDL types and Java types. Note that OMG IDL, as its name implies, defines interfaces. Like Java interfaces, IDL interfaces contain no implementations for their operations (methods in Java). In other words, IDL interfaces define only the signature for an operation (the name of the operation, the data type of its return value, the data types of the parameters that it takes, and any exceptions that it raises). The implementations for these operations need to be supplied in Java classes written by a Java programmer.

The following table lists the main constructs of IDL and the corresponding constructs in Java.

IDL Type

Java Type

module

package

boolean

boolean

char, wchar

char

octet

byte

string, wstring

java.lang.String

short, unsigned short

short

long, unsigned long

int

long long, unsigned long long

long

float

float

double

double

fixed

java.math.BigDecimal

enum, struct, union

class

sequence, array

array

interface (non-abstract)

signature interface and an operations interface, helper class, holder class

interface (abstract)

signature interface, helper class, holder class

constant (not within an interface)

public interface

constant (within an interface)

fields in the Java signature interface for non-abstract, or the sole Java interface for abstract

exception

class

Any

org.omg.CORBA.Any

type declarations nested within interfaces

"scoped" package

typedef

helper classes

pseudo objects

pseudo interface

readonly attribute

accessor method

readwrite attribute

accessor and modifer methods

operation

method


Java IDL Home