OOPortal OOPortal

IDL Constructed Types   «Prev  Next»
Lesson 3 Mapping for sequences
Objective 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, XHelper and XHolder, are generated for a sequence X.


Let us take a look at an example with both bounded and unbounded IDL sequences and see how they are mapped to Java. Where the FullWeekForecasts and ForecastList sequences appear in the WeatherService interface, corresponding Java arrays are generated:

1) The IDL interface using bounded and unbounded sequences is mapped to its Java operations interface using corresponding Java Arrays.
2) The operation returning the bounded sequence is mapped to a method returning the corresponding array type
3) 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 FullWeekForecasts and ForecastList.
There are the expected helpers and holders: ForecastListHelper, ForecastListHolder, FullWeekForecastsHelper, and FullWeekForecastsHolder.

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

Click on the Quiz link below to test your knowledge of IDL-to-Java mapping for sequences.
IDL To Java Mapping For Sequences - Quiz