Java Code Examples for org.omg.CORBA.TCKind._tk_union

The following are Jave code examples for showing how to use _tk_union of the org.omg.CORBA.TCKind class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: OpenJSharp   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public String id()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        //return indirectType().id(); // same as _id
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        // exception and objref typecodes must have a repository id.
        // structs, unions, enums, and aliases may or may not.
        return _id;
    default:
        // all other typecodes throw the BadKind exception.
        throw new BadKind();
    }
}
 
Example 2
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
    if (_kind != TCKind._tk_union)
        throw new BadKind();

    try {
        for (int i=0; i<member_count(); i++) {
            if (member_label(i).equal(discriminatorValue)) {
                return i;
            }
        }
        if (_defaultIndex != -1) {
            return _defaultIndex;
        }
    } catch (BadKind bad) {
    } catch (org.omg.CORBA.TypeCodePackage.Bounds bounds) {
    }
    return -1;
}
 
Example 3
Project: OpenJSharp   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public String member_name(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_name(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        try {
            return _memberNames[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 4
Project: OpenJSharp   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public TypeCode member_type(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_type(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_value:
        try {
            return _memberTypes[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 5
Project: OpenJSharp   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public Any member_label(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_label(index);
    case TCKind._tk_union:
        try {
            // _REVISIT_ Why create a new Any for this?
            return new AnyImpl(_orb, _unionLabels[index]);
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 6
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public Any member_label(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_label(index);
    case TCKind._tk_union:
        try {
            // _REVISIT_ Why create a new Any for this?
            return new AnyImpl(_orb, _unionLabels[index]);
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 7
Project: OpenJSharp   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
    if (_kind != TCKind._tk_union)
        throw new BadKind();

    try {
        for (int i=0; i<member_count(); i++) {
            if (member_label(i).equal(discriminatorValue)) {
                return i;
            }
        }
        if (_defaultIndex != -1) {
            return _defaultIndex;
        }
    } catch (BadKind bad) {
    } catch (org.omg.CORBA.TypeCodePackage.Bounds bounds) {
    }
    return -1;
}
 
Example 8
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public TypeCode member_type(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_type(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_value:
        try {
            return _memberTypes[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 9
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public String id()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        //return indirectType().id(); // same as _id
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        // exception and objref typecodes must have a repository id.
        // structs, unions, enums, and aliases may or may not.
        return _id;
    default:
        // all other typecodes throw the BadKind exception.
        throw new BadKind();
    }
}
 
Example 10
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public String name()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().name();
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        return _name;
    default:
        throw new BadKind();
    }
}
 
Example 11
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public int member_count()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_count();
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        return _memberCount;
    default:
        throw new BadKind();
    }
}
 
Example 12
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 6 votes
public String member_name(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_name(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        try {
            return _memberNames[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 13
Project: OpenJSharp   File: TypeCodeImpl.java   View Source Code Vote up 5 votes
public TypeCodeImpl(ORB orb,
                    int creationKind,
                    String id,
                    String name,
                    TypeCode discriminator_type,
                    UnionMember[] members)
                    // for unions
{
    this(orb) ;

    if (creationKind == TCKind._tk_union) {
        _kind               = creationKind;
        setId(id);
        _name               = name;
        _memberCount        = members.length;
        _discriminator      = convertToNative(_orb, discriminator_type);

        _memberNames = new String[_memberCount];
        _memberTypes = new TypeCodeImpl[_memberCount];
        _unionLabels = new AnyImpl[_memberCount];

        for (int i = 0 ; i < _memberCount ; i++) {
            _memberNames[i] = members[i].name;
            _memberTypes[i] = convertToNative(_orb, members[i].type);
            _memberTypes[i].setParent(this);
            _unionLabels[i] = new AnyImpl(_orb, members[i].label);
            // check whether this is the default branch.
            if (_unionLabels[i].type().kind() == TCKind.tk_octet) {
                if (_unionLabels[i].extract_octet() == (byte)0) {
                    _defaultIndex = i;
                }
            }
        }
    } // else initializes to null
}
 
Example 14
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 5 votes
public TypeCode discriminator_type()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().discriminator_type();
    case TCKind._tk_union:
        return _discriminator;
    default:
        throw new BadKind();
    }
}
 
Example 15
Project: OpenJSharp   File: TypeCodeImpl.java   View Source Code Vote up 5 votes
public int default_index()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().default_index();
    case TCKind._tk_union:
        return _defaultIndex;
    default:
        throw new BadKind();
    }
}
 
Example 16
Project: openjdk-jdk10   File: ORBSingleton.java   View Source Code Vote up 5 votes
public TypeCode create_union_tc(String id,
                                String name,
                                TypeCode discriminator_type,
                                UnionMember[] members)
{
    return new TypeCodeImpl(this,
                            TCKind._tk_union,
                            id,
                            name,
                            discriminator_type,
                            members);
}
 
Example 17
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 5 votes
public int default_index()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().default_index();
    case TCKind._tk_union:
        return _defaultIndex;
    default:
        throw new BadKind();
    }
}
 
Example 18
Project: OpenJSharp   File: DynAnyUtil.java   View Source Code Vote up 5 votes
static DynAny createMostDerivedDynAny(TypeCode typeCode, ORB orb)
    throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
{
    if (typeCode == null || ! DynAnyUtil.isConsistentType(typeCode))
        throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();

    switch (typeCode.kind().value()) {
        case TCKind._tk_sequence:
            return new DynSequenceImpl(orb, typeCode);
        case TCKind._tk_struct:
            return new DynStructImpl(orb, typeCode);
        case TCKind._tk_array:
            return new DynArrayImpl(orb, typeCode);
        case TCKind._tk_union:
            return new DynUnionImpl(orb, typeCode);
        case TCKind._tk_enum:
            return new DynEnumImpl(orb, typeCode);
        case TCKind._tk_fixed:
            return new DynFixedImpl(orb, typeCode);
        case TCKind._tk_value:
            return new DynValueImpl(orb, typeCode);
        case TCKind._tk_value_box:
            return new DynValueBoxImpl(orb, typeCode);
        default:
            return new DynAnyBasicImpl(orb, typeCode);
    }
}
 
Example 19
Project: openjdk-jdk10   File: DynAnyUtil.java   View Source Code Vote up 5 votes
static DynAny createMostDerivedDynAny(TypeCode typeCode, ORB orb)
    throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
{
    if (typeCode == null || ! DynAnyUtil.isConsistentType(typeCode))
        throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();

    switch (typeCode.kind().value()) {
        case TCKind._tk_sequence:
            return new DynSequenceImpl(orb, typeCode);
        case TCKind._tk_struct:
            return new DynStructImpl(orb, typeCode);
        case TCKind._tk_array:
            return new DynArrayImpl(orb, typeCode);
        case TCKind._tk_union:
            return new DynUnionImpl(orb, typeCode);
        case TCKind._tk_enum:
            return new DynEnumImpl(orb, typeCode);
        case TCKind._tk_fixed:
            return new DynFixedImpl(orb, typeCode);
        case TCKind._tk_value:
            return new DynValueImpl(orb, typeCode);
        case TCKind._tk_value_box:
            return new DynValueBoxImpl(orb, typeCode);
        default:
            return new DynAnyBasicImpl(orb, typeCode);
    }
}
 
Example 20
Project: openjdk-jdk10   File: TypeCodeImpl.java   View Source Code Vote up 5 votes
public TypeCodeImpl(ORB orb,
                    int creationKind,
                    String id,
                    String name,
                    TypeCode discriminator_type,
                    UnionMember[] members)
                    // for unions
{
    this(orb) ;

    if (creationKind == TCKind._tk_union) {
        _kind               = creationKind;
        setId(id);
        _name               = name;
        _memberCount        = members.length;
        _discriminator      = convertToNative(_orb, discriminator_type);

        _memberNames = new String[_memberCount];
        _memberTypes = new TypeCodeImpl[_memberCount];
        _unionLabels = new AnyImpl[_memberCount];

        for (int i = 0 ; i < _memberCount ; i++) {
            _memberNames[i] = members[i].name;
            _memberTypes[i] = convertToNative(_orb, members[i].type);
            _memberTypes[i].setParent(this);
            _unionLabels[i] = new AnyImpl(_orb, members[i].label);
            // check whether this is the default branch.
            if (_unionLabels[i].type().kind() == TCKind.tk_octet) {
                if (_unionLabels[i].extract_octet() == (byte)0) {
                    _defaultIndex = i;
                }
            }
        }
    } // else initializes to null
}