e.g.
colorT
colorTHelper
colorTHolder |
// J#
package demo.unions;
/**
* Enum definition : colorT
*
* @author TomORB J# Native Compiler
*/
public final class colorT implements org.omg.CORBA.portable.IDLEntity
{
/**
* Enum member green value
*/
public static final int _green = 0;
/**
* Enum member green
*/
public static final colorT green = new colorT(_green);
/**
* Enum member blue value
*/
public static final int _blue = 1;
/**
* Enum member blue
*/
public static final colorT blue = new colorT(_blue);
/**
* Enum member red value
*/
public static final int _red = 2;
/**
* Enum member red
*/
public static final colorT red = new colorT(_red);
/**
* Enum member black value
*/
public static final int _black = 3;
/**
* Enum member black
*/
public static final colorT black = new colorT(_black);
/**
* Internal member value
*/
private final int _colorT_value;
/**
* Private constructor
* @param the enum value for this new member
*/
private colorT( final int value )
{
_colorT_value = value;
}
/**
* Maintains singleton property for serialized enums.
* Issue 4271: IDL/Java issue, Mapping for IDL enum.
*/
public java.lang.Object readResolve() throws java.io.ObjectStreamException
{
return from_int( value() );
}
/**
* Return the internal member value
* @return the member value
*/
public int value()
{
return _colorT_value;
}
/**
* Return a enum member from its value
* @param an enum value
* @return an enum member
*/
public static colorT from_int(int value)
{
switch (value)
{
case 0 :
return green;
case 1 :
return blue;
case 2 :
return red;
case 3 :
return black;
}
throw new org.omg.CORBA.BAD_OPERATION();
}
/**
* Return a string representation
* @return a string representation of the enumeration
*/
public java.lang.String toString()
{
switch (_colorT_value)
{
case 0 :
return "green";
case 1 :
return "blue";
case 2 :
return "red";
case 3 :
return "black";
}
throw new org.omg.CORBA.BAD_OPERATION();
}
}
package demo.unions;
/**
* Helper class for : colorT
*
* @author TomORB J# Native Compiler
*/
public class colorTHelper
{
/**
* Insert colorT into an any
* @param a an any
* @param t colorT value
*/
public static void insert(org.omg.CORBA.Any a, demo.unions.colorT t)
{
a.type(type());
write(a.create_output_stream(),t);
}
/**
* Extract colorT from an any
* @param a an any
* @return the extracted colorT value
*/
public static demo.unions.colorT extract(org.omg.CORBA.Any a)
{
if (!a.type().equal(type()))
throw new org.omg.CORBA.MARSHAL();
return read(a.create_input_stream());
}
//
// Internal TypeCode value
//
private static org.omg.CORBA.TypeCode _tc = null;
/**
* Return the colorT TypeCode
* @return a TypeCode
*/
public static org.omg.CORBA.TypeCode type()
{
if (_tc == null) {
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
java.lang.String []_members = new java.lang.String[4];
_members[0] = "green";
_members[1] = "blue";
_members[2] = "red";
_members[3] = "black";
_tc = orb.create_enum_tc(id(),"colorT",_members);
}
return _tc;
}
/**
* Return the colorT IDL ID
* @return an ID
*/
public static java.lang.String id()
{
return _id;
}
private final static java.lang.String _id = "IDL:demo/unions/colorT:1.0";
/**
* Read colorT from a marshalled stream
* @param istream the input stream
* @return the readed colorT value
*/
public static demo.unions.colorT read(org.omg.CORBA.portable.InputStream istream)
{
return colorT.from_int(istream.read_ulong());
}
/**
* Write colorT into a marshalled stream
* @param ostream the output stream
* @param value colorT value
*/
public static void write(org.omg.CORBA.portable.OutputStream ostream, demo.unions.colorT value)
{
ostream.write_ulong(value.value());
}
}
package demo.unions;
/**
* Holder class for : colorT
*
* @author TomORB J# Native Compiler
*/
final public class colorTHolder
implements org.omg.CORBA.portable.Streamable
{
/**
* Internal colorT value
*/
public demo.unions.colorT value;
/**
* Default constructor
*/
public colorTHolder()
{ }
/**
* Constructor with value initialisation
* @param initial the initial value
*/
public colorTHolder(demo.unions.colorT initial)
{
value = initial;
}
/**
* Read colorT from a marshalled stream
* @param istream the input stream
*/
public void _read(org.omg.CORBA.portable.InputStream istream)
{
value = colorTHelper.read(istream);
}
/**
* Write colorT into a marshalled stream
* @param ostream the output stream
*/
public void _write(org.omg.CORBA.portable.OutputStream ostream)
{
colorTHelper.write(ostream,value);
}
/**
* Return the colorT TypeCode
* @return a TypeCode
*/
public org.omg.CORBA.TypeCode _type()
{
return colorTHelper.type();
}
}
|