Emitting bindings for include files

By default, only those interfaces, structs, and so on, that are defined in the Interface Definition Language (IDL) file on the command line have the Java bindings generated for them. The types defined in included files are not generated. For example, assume the following two IDL files:

My.idl
 
#include MyOther.idl
interface My
{
};

MyOther.idl
 
interface MyOther
{
};

The following command only generates bindings for types within My:

idlj My.idl

To generate bindings for all of the types in My.idl and all of the types in files that My.idl includes (in this example, MyOther.idl), use the following command:

idlj -emitAll My.idl

There is a caveat to the default rule. #include statements, which appear at the global scope, are treated as described. These #include statements can be thought of as import statements. #include statements that appear within some enclosing scope are treated as true #include statements. This means that the code within the included file is treated as if it appeared in the original file and, therefore, Java bindings are emitted for it. Here is an example:

My.idl
 
#include MyOther.idl
interface My
{
  #include Embedded.idl
};

MyOther.idl
 
interface MyOther
{
};

Embedded.idl
 
enum E {one, two, three};

Running the following command:

idlj My.idl

will generate the following list of Java files:

./MyHolder.java
./MyHelper.java
./_MyStub.java
./MyPackage
./MyPackage/EHolder.java
./MyPackage/EHelper.java
./MyPackage/E.java
./My.java

Note: MyOther.java is not generated because it is defined in an import-like #include. But E.java is generated because it is defined in a true #include. Also, because Embedded.idl was included within the scope of the interface My, it appears within the scope of My (that is, in MyPackage).

If the -emitAll flag is used in the previous example, all types in all of the included files are emitted.


Related reference
IDL-to-Java compiler



Searchable topic ID:   rcor_idl2j3
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/corba/ref/rcor_idl2j3.html

Library | Support | Terms of Use | Feedback