2.8.5 array
IDL arrayは,IDLのバウンデッドシーケンスと同じようにマッピングされます。マッピングでは,配列型が必要な場所に,配列要素がマッピングされた型の配列が使用されます。Javaでは,通常のJava添字指定演算子がマッピングされた配列に適用されます。配列の長さは,定数規則でマッピングされるIDL定数によって上限値を与えることで,Javaで利用できます。
配列のHolderクラスも生成されます。その名前は,次のように配列がマッピングされたJavaクラス名の後ろにHolderを付けたものです。
- コードサンプル2-18 配列のHolderクラス
final public class <array_class>Holder implements org.omg.CORBA.portable.Streamable { public <array_element_type>[ ] value; public <array_class>Holder( ) {} public <array_class>Holder( <array_element_type>[ ] initial) {...} public void _read(org.omg.CORBA.portable.InputStream i) {...} public void _write( org.omg.CORBA.portable.OutputStream o) {...} public org.omg.CORBA.TypeCode _type( ) {...} }
- コードサンプル2-19 配列のマッピング
// IDL const long ArrayBound = 42; typedef long larray[ArrayBound]; // generated Java final public class larrayHolder implements org.omg.CORBA.portable.Streamable { public int[ ] value; public larrayHolder( ) {} public larrayHolder(int[ ] initial) {...} public void _read(org.omg.CORBA.portable.InputStream i) {...} public void _write( org.omg.CORBA.portable.OutputStream o) {...} public org.omg.CORBA.TypeCode_type( ) {...} }