SIDL's object model is very similar to Java's, and therefore maps easily into Java's object model. A SIDL object is treated almost exactly the same in Java as any other Java object, the only difference being that all data held by the object is private, and all methods are public.
Importing SIDL packages and classes is also exactly the same as in Java. For example, assume there is a package test that includes the class HelloWorld, and you wish to print this message in your program. The following code segment does this.
import test.HelloWorld; public static main(String args[]) { HelloWorld hi = new HelloWorld(); hi.printMsg(); }
Writing the fully qualified class name would also have sufficed. test.HelloWorld hi = new test.HelloWorld()
Babel also generates Java code in line with Java's use of directories to organize packages and classes as files. For example, assume you are generating babel code in a directory named babelcode. Assume your package test contains 2 classes HelloWorld and GoodbyeWorld. After running babel -cJava test.sidl you will have a new directory in babelcode named test which will contain 2 files, HelloWorld.java and GoodbyeWorld.java. These classes will be accessible from your Java program as long as babelcode is in your CLASSPATH.