Lesson 8 | Interface inheritance |
Objective | Describe how IDL interface inheritance maps to Java. |
IDL interface inheritance maps to Java
Now that you have learned more about how Java interfaces and classes are generated from a given IDL interface, we will expand our picture of interface mapping by discussing how IDL interface inheritance affects the generated Java code.
This is important because you will frequently need to work with such code.
Interface inheritance mapping
IDL interface inheritance is reflected in the corresponding generated Java signature and operations interfaces.
If the IDL interface Sub
extends interface Base
, then the generated Java interface SubOperations
will extend BaseOperations
and the generated Java interface
Sub
will extend the generated Java interface Base
.
The child's stub and skeleton will also be generated to indicate via accessor methods that they support both the child's IDL type and the parent's IDL type.
Example
As an example, consider the following variation on our basic Weather Service. The IDL has two interfaces, the second of which inherits from the first:
Corba Interface Inheritance
This IDL produces the Java code already shown for the Weather Service in previous lessons, as well as the additional code for the new Scoreable Weather Service.
In particular, the signature and operations interfaces inherit from their Weather Service counterparts.
Java code that uses these interface types can now take advantage of the inheritance that has been mapped from the IDL.
In the next lesson, we will return to the work of writing a full CORBA system by learning how to write basic CORBA clients.
Idl Interface Inheritance Mapping - Quiz