| Lesson 3
| Mapping for sequences
| Describe and use the Java produced by the Mapping for IDL sequences.
Corba sequence mapping
IDL sequences are basically one-dimensional arrays with an associated length. IDL sequences are mapped to Java arrays wherever they are used.
No explicit sequence Java class is generated for an IDL sequence. An IDL sequence
X is mapped to a Java array
X of a Java element type that corresponds to the Java mapping for the IDL element type.
IDL has both bounded and unbounded sequences. The only difference in the way that they are treated is that bounded sequences are length checked during marshaling, when an IDL
CORBA::MARSHAL exception can be raised.
Helper and holder classes,
XHolder, are generated for a sequence
Let us take a look at an example with both bounded and unbounded IDL sequences and see how they are mapped to Java.
ForecastList sequences appear in the WeatherService interface, corresponding Java arrays are generated:
- The IDL interface using bounded and unbounded sequences is mapped to its Java operations interface using corresponding Java Arrays.
- The operation returning the bounded sequence is mapped to a method returning the corresponding array type
- The operation returning the unbounded sequence is mapped to a method returning the corresponding array type
Sequences Interface WeatherService
No explicit sequence classes are generated for
There are the expected helpers and holders:
Using sequences in Java
Because no explicit classes are generated for sequences, using them in Java is simply a matter of using the corresponding Java arrays.
In the next lesson, you will learn the Java mapping for IDL enums and how to use the resulting Java.
IDL To Java Mapping For Sequences - Quiz