2.8.4 sequence

IDL sequenceは同じ名前でJava配列にマッピングされます。マッピングでは,sequence型が必要な場所に,sequence要素のマッピングされた型の配列が使用されます。

sequenceのHolderクラスも生成されます。その名前は,次のようにsequenceがマッピングされたJavaクラス名の後ろにHolderを付けたものです。

コードサンプル2-16 sequenceのHolderクラス

final public class <sequence_class>Holder {
  public <sequence_element_type>[ ] value;
  public <sequence_class>Holder( ) {};
  public <sequence_class>Holder(
            <sequence_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-17 IDL sequenceのJavaへのマッピング

// IDL
typedef sequence<long>UnboundedData;
typedef sequence<long, 42>BoundedData;

// generated Java
final public class UnboundedDataHolder
       implements org.omg.CORBA.portable.Streamable {
   public int[ ] value;
   public UnboundedDataHolder( ) {};
   public UnboundedDataHolder(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( ) {...}
}

final public class BoundedDataHolder
       implements org.omg.CORBA.portable.Streamable {
   public int[ ] value;
   public BoundedDataHolder( ) {};
   public BoundedDataHolder(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( ) {...}
}