IDL structは,IDLのインスタンス変数,およびすべての値のメンバを順序どおりに,同名のファイナルJavaクラスにマッピングします。ヌルコンストラクタも提供され,これによって構造体フィールドをあとで初期化することもできます。structのHolderクラスも生成されます。その名前は,次のようにsturctがマッピングされたJavaクラス名の後ろにHolderを付けたものです。
final public class <class>Holder implements
org.omg.CORBA.portable.Streamable {
public <class> value;
public <class>Holder( ) {}
public <class>Holder(<class> 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( ) {...}
}
/*From Example.idl:*/
module Example {
struct StructType {
long field1;
string field2;
};
};
//generated Java
public final class StructType
implements org.omg.CORBA.portable.IDLEntity {
public int field1;
public java.lang.String field2;
public StructType( ){...}
public StructType(final int field1,
final java.lang.String field2){...}
public java.lang.String toString( ) {...}
public boolean equals(java.lang.Object o) {...}
}
public final class StructTypeHolder
implements org.omg.CORBA.portable.Streamable {
public Example.StructType value;
public StructTypeHolder( ){...}
public StructTypeHolder(
final Example.StructType _vis_value)
{...}
public void _read(
final org.omg.CORBA.portable.InputStream input)
{...}
public void _write(
final org.omg.CORBA.portable.OutputStream output)
{...}
public org.omg.CORBA.TypeCode _type ( ){...}
}