Java Code Examples for org.omg.CORBA.TCKind#_tk_enum
The following examples show how to use
org.omg.CORBA.TCKind#_tk_enum .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeCodeImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public TypeCodeImpl(ORB orb, int creationKind, String id, String name, String[] members) // for enums { this(orb) ; if (creationKind == TCKind._tk_enum) { _kind = creationKind; setId(id); _name = name; _memberCount = members.length; _memberNames = new String[_memberCount]; for (int i = 0 ; i < _memberCount ; i++) _memberNames[i] = members[i]; } // else initializes to null }
Example 2
Source File: TypeCodeImpl.java From openjdk-8 with GNU General Public License v2.0 | 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 3
Source File: TypeCodeImpl.java From JDKSourceCode1.8 with MIT License | 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
Source File: TypeCodeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 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 5
Source File: TypeCodeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public TypeCodeImpl(ORB orb, int creationKind, String id, String name, String[] members) // for enums { this(orb) ; if (creationKind == TCKind._tk_enum) { _kind = creationKind; setId(id); _name = name; _memberCount = members.length; _memberNames = new String[_memberCount]; for (int i = 0 ; i < _memberCount ; i++) _memberNames[i] = members[i]; } // else initializes to null }
Example 6
Source File: TypeCodeImpl.java From openjdk-8-source with GNU General Public License v2.0 | 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 7
Source File: TypeCodeImpl.java From jdk8u60 with GNU General Public License v2.0 | 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 8
Source File: TypeCodeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 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 9
Source File: TypeCodeImpl.java From hottub with GNU General Public License v2.0 | 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 10
Source File: TypeCodeImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public TypeCodeImpl(ORB orb, int creationKind, String id, String name, String[] members) // for enums { this(orb) ; if (creationKind == TCKind._tk_enum) { _kind = creationKind; setId(id); _name = name; _memberCount = members.length; _memberNames = new String[_memberCount]; for (int i = 0 ; i < _memberCount ; i++) _memberNames[i] = members[i]; } // else initializes to null }
Example 11
Source File: TypeCodeImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 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 12
Source File: DynAnyUtil.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
static boolean isConstructedDynAny(DynAny dynAny) { // DynFixed is constructed but not a subclass of DynAnyConstructedImpl //return (dynAny instanceof DynAnyConstructedImpl); int kind = dynAny.type().kind().value(); return (kind == TCKind._tk_sequence || kind == TCKind._tk_struct || kind == TCKind._tk_array || kind == TCKind._tk_union || kind == TCKind._tk_enum || kind == TCKind._tk_fixed || kind == TCKind._tk_value || kind == TCKind._tk_value_box); }
Example 13
Source File: DynAnyUtil.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static DynAny createMostDerivedDynAny(Any any, ORB orb, boolean copyValue) throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode { if (any == null || ! DynAnyUtil.isConsistentType(any.type())) throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode(); switch (any.type().kind().value()) { case TCKind._tk_sequence: return new DynSequenceImpl(orb, any, copyValue); case TCKind._tk_struct: return new DynStructImpl(orb, any, copyValue); case TCKind._tk_array: return new DynArrayImpl(orb, any, copyValue); case TCKind._tk_union: return new DynUnionImpl(orb, any, copyValue); case TCKind._tk_enum: return new DynEnumImpl(orb, any, copyValue); case TCKind._tk_fixed: return new DynFixedImpl(orb, any, copyValue); case TCKind._tk_value: return new DynValueImpl(orb, any, copyValue); case TCKind._tk_value_box: return new DynValueBoxImpl(orb, any, copyValue); default: return new DynAnyBasicImpl(orb, any, copyValue); } }
Example 14
Source File: ORBSingleton.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public TypeCode create_enum_tc(String id, String name, String[] members) { return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members); }
Example 15
Source File: TypeCodeImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private void printStream(PrintStream s, int level) { if (_kind == tk_indirect) { s.print("indirect " + _id); return; } switch (_kind) { case TCKind._tk_null: case TCKind._tk_void: case TCKind._tk_short: case TCKind._tk_long: case TCKind._tk_ushort: case TCKind._tk_ulong: case TCKind._tk_float: case TCKind._tk_double: case TCKind._tk_boolean: case TCKind._tk_char: case TCKind._tk_octet: case TCKind._tk_any: case TCKind._tk_TypeCode: case TCKind._tk_Principal: case TCKind._tk_objref: case TCKind._tk_longlong: case TCKind._tk_ulonglong: case TCKind._tk_longdouble: case TCKind._tk_wchar: case TCKind._tk_native: s.print(kindNames[_kind] + " " + _name); break; case TCKind._tk_struct: case TCKind._tk_except: case TCKind._tk_value: s.println(kindNames[_kind] + " " + _name + " = {"); for(int i=0; i<_memberCount; i++) { // memberName might differ from the name of the member. s.print(indent(level + 1)); if (_memberTypes[i] != null) _memberTypes[i].printStream(s, level + 1); else s.print("<unknown type>"); s.println(" " + _memberNames[i] + ";"); } s.print(indent(level) + "}"); break; case TCKind._tk_union: s.print("union " + _name + "..."); break; case TCKind._tk_enum: s.print("enum " + _name + "..."); break; case TCKind._tk_string: if (_length == 0) s.print("unbounded string " + _name); else s.print("bounded string(" + _length + ") " + _name); break; case TCKind._tk_sequence: case TCKind._tk_array: s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {"); s.print(indent(level + 1)); if (lazy_content_type() != null) { lazy_content_type().printStream(s, level + 1); } s.println(indent(level) + "}"); break; case TCKind._tk_alias: s.print("alias " + _name + " = " + (_contentType != null ? _contentType._name : "<unresolved>")); break; case TCKind._tk_wstring: s.print("wstring[" + _length + "] " + _name); break; case TCKind._tk_fixed: s.print("fixed(" + _digits + ", " + _scale + ") " + _name); break; case TCKind._tk_value_box: s.print("valueBox " + _name + "..."); break; case TCKind._tk_abstract_interface: s.print("abstractInterface " + _name + "..."); break; default: s.print("<unknown type>"); break; } }
Example 16
Source File: ORBSingleton.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public TypeCode create_enum_tc(String id, String name, String[] members) { return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members); }
Example 17
Source File: TypeCodeImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private void printStream(PrintStream s, int level) { if (_kind == tk_indirect) { s.print("indirect " + _id); return; } switch (_kind) { case TCKind._tk_null: case TCKind._tk_void: case TCKind._tk_short: case TCKind._tk_long: case TCKind._tk_ushort: case TCKind._tk_ulong: case TCKind._tk_float: case TCKind._tk_double: case TCKind._tk_boolean: case TCKind._tk_char: case TCKind._tk_octet: case TCKind._tk_any: case TCKind._tk_TypeCode: case TCKind._tk_Principal: case TCKind._tk_objref: case TCKind._tk_longlong: case TCKind._tk_ulonglong: case TCKind._tk_longdouble: case TCKind._tk_wchar: case TCKind._tk_native: s.print(kindNames[_kind] + " " + _name); break; case TCKind._tk_struct: case TCKind._tk_except: case TCKind._tk_value: s.println(kindNames[_kind] + " " + _name + " = {"); for(int i=0; i<_memberCount; i++) { // memberName might differ from the name of the member. s.print(indent(level + 1)); if (_memberTypes[i] != null) _memberTypes[i].printStream(s, level + 1); else s.print("<unknown type>"); s.println(" " + _memberNames[i] + ";"); } s.print(indent(level) + "}"); break; case TCKind._tk_union: s.print("union " + _name + "..."); break; case TCKind._tk_enum: s.print("enum " + _name + "..."); break; case TCKind._tk_string: if (_length == 0) s.print("unbounded string " + _name); else s.print("bounded string(" + _length + ") " + _name); break; case TCKind._tk_sequence: case TCKind._tk_array: s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {"); s.print(indent(level + 1)); if (lazy_content_type() != null) { lazy_content_type().printStream(s, level + 1); } s.println(indent(level) + "}"); break; case TCKind._tk_alias: s.print("alias " + _name + " = " + (_contentType != null ? _contentType._name : "<unresolved>")); break; case TCKind._tk_wstring: s.print("wstring[" + _length + "] " + _name); break; case TCKind._tk_fixed: s.print("fixed(" + _digits + ", " + _scale + ") " + _name); break; case TCKind._tk_value_box: s.print("valueBox " + _name + "..."); break; case TCKind._tk_abstract_interface: s.print("abstractInterface " + _name + "..."); break; default: s.print("<unknown type>"); break; } }
Example 18
Source File: CorbaUnionHandler.java From cxf with Apache License 2.0 | 4 votes |
public String createDefaultDiscriminatorLabel() { String label = null; // According to the CORBA specification, an enumeration discriminator can be one of the // following types: // - *integer* (short, long, ulong, either signed or unsigned) // - boolean // - character // - enumeration // So when we need to create a default discriminator to accomodate for the lack of a // discriminator from, these are the four cases we must check for. if (discriminator.getTypeCodeKind().value() == TCKind._tk_boolean) { // We can only have a default case with a boolean discriminator if we have // only one case, either TRUE or FALSE. Therefore, we only need to check // against the first label, if there is one. if (labels.isEmpty()) { label = "false"; } else { boolean boolValue = Boolean.parseBoolean(labels.get(0)); label = String.valueOf(!boolValue); } } else if (discriminator.getTypeCodeKind().value() == TCKind._tk_char) { if (labels.isEmpty()) { label = String.valueOf('0'); } else { char charValue = labels.get(0).charAt(0); while (labels.contains(String.valueOf(charValue))) { charValue++; } label = String.valueOf(charValue); } } else if (discriminator.getTypeCodeKind().value() == TCKind._tk_enum) { // Get the list of possible enumerations in the enumerator and compare these to the // labels we obtained from the Union definition. In order for the union/enum // combination to be syntactically correct, there must be one enumeration not included // as a case for the default case to be valid. Enum enumType = (Enum)discriminator.getType(); List<Enumerator> enumerators = enumType.getEnumerator(); if (labels.isEmpty()) { // Any value will do since we only have a default case. label = enumerators.get(0).getValue(); } else { String enumLabel = null; for (Iterator<Enumerator> enumIter = enumerators.iterator(); enumIter.hasNext();) { enumLabel = enumIter.next().getValue(); if (!labels.contains(enumLabel)) { label = enumLabel; break; } } } } else if ((discriminator.getTypeCodeKind().value() == TCKind._tk_short) || (discriminator.getTypeCodeKind().value() == TCKind._tk_ushort)) { if (labels.isEmpty()) { label = String.valueOf(Short.MAX_VALUE); } for (int i = Short.MAX_VALUE; i >= Short.MIN_VALUE; i--) { if (!labels.contains(String.valueOf(i))) { label = String.valueOf(i); break; } } } else if ((discriminator.getTypeCodeKind().value() == TCKind._tk_long) || (discriminator.getTypeCodeKind().value() == TCKind._tk_ulong)) { if (labels.isEmpty()) { label = String.valueOf(Integer.MAX_VALUE); } for (int i = Integer.MAX_VALUE; i >= Integer.MIN_VALUE; i--) { if (!labels.contains(String.valueOf(i))) { label = String.valueOf(i); break; } } } return label; }
Example 19
Source File: TypeCodeImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private void printStream(PrintStream s, int level) { if (_kind == tk_indirect) { s.print("indirect " + _id); return; } switch (_kind) { case TCKind._tk_null: case TCKind._tk_void: case TCKind._tk_short: case TCKind._tk_long: case TCKind._tk_ushort: case TCKind._tk_ulong: case TCKind._tk_float: case TCKind._tk_double: case TCKind._tk_boolean: case TCKind._tk_char: case TCKind._tk_octet: case TCKind._tk_any: case TCKind._tk_TypeCode: case TCKind._tk_Principal: case TCKind._tk_objref: case TCKind._tk_longlong: case TCKind._tk_ulonglong: case TCKind._tk_longdouble: case TCKind._tk_wchar: case TCKind._tk_native: s.print(kindNames[_kind] + " " + _name); break; case TCKind._tk_struct: case TCKind._tk_except: case TCKind._tk_value: s.println(kindNames[_kind] + " " + _name + " = {"); for(int i=0; i<_memberCount; i++) { // memberName might differ from the name of the member. s.print(indent(level + 1)); if (_memberTypes[i] != null) _memberTypes[i].printStream(s, level + 1); else s.print("<unknown type>"); s.println(" " + _memberNames[i] + ";"); } s.print(indent(level) + "}"); break; case TCKind._tk_union: s.print("union " + _name + "..."); break; case TCKind._tk_enum: s.print("enum " + _name + "..."); break; case TCKind._tk_string: if (_length == 0) s.print("unbounded string " + _name); else s.print("bounded string(" + _length + ") " + _name); break; case TCKind._tk_sequence: case TCKind._tk_array: s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {"); s.print(indent(level + 1)); if (lazy_content_type() != null) { lazy_content_type().printStream(s, level + 1); } s.println(indent(level) + "}"); break; case TCKind._tk_alias: s.print("alias " + _name + " = " + (_contentType != null ? _contentType._name : "<unresolved>")); break; case TCKind._tk_wstring: s.print("wstring[" + _length + "] " + _name); break; case TCKind._tk_fixed: s.print("fixed(" + _digits + ", " + _scale + ") " + _name); break; case TCKind._tk_value_box: s.print("valueBox " + _name + "..."); break; case TCKind._tk_abstract_interface: s.print("abstractInterface " + _name + "..."); break; default: s.print("<unknown type>"); break; } }
Example 20
Source File: TypeCodeImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void printStream(PrintStream s, int level) { if (_kind == tk_indirect) { s.print("indirect " + _id); return; } switch (_kind) { case TCKind._tk_null: case TCKind._tk_void: case TCKind._tk_short: case TCKind._tk_long: case TCKind._tk_ushort: case TCKind._tk_ulong: case TCKind._tk_float: case TCKind._tk_double: case TCKind._tk_boolean: case TCKind._tk_char: case TCKind._tk_octet: case TCKind._tk_any: case TCKind._tk_TypeCode: case TCKind._tk_Principal: case TCKind._tk_objref: case TCKind._tk_longlong: case TCKind._tk_ulonglong: case TCKind._tk_longdouble: case TCKind._tk_wchar: case TCKind._tk_native: s.print(kindNames[_kind] + " " + _name); break; case TCKind._tk_struct: case TCKind._tk_except: case TCKind._tk_value: s.println(kindNames[_kind] + " " + _name + " = {"); for(int i=0; i<_memberCount; i++) { // memberName might differ from the name of the member. s.print(indent(level + 1)); if (_memberTypes[i] != null) _memberTypes[i].printStream(s, level + 1); else s.print("<unknown type>"); s.println(" " + _memberNames[i] + ";"); } s.print(indent(level) + "}"); break; case TCKind._tk_union: s.print("union " + _name + "..."); break; case TCKind._tk_enum: s.print("enum " + _name + "..."); break; case TCKind._tk_string: if (_length == 0) s.print("unbounded string " + _name); else s.print("bounded string(" + _length + ") " + _name); break; case TCKind._tk_sequence: case TCKind._tk_array: s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {"); s.print(indent(level + 1)); if (lazy_content_type() != null) { lazy_content_type().printStream(s, level + 1); } s.println(indent(level) + "}"); break; case TCKind._tk_alias: s.print("alias " + _name + " = " + (_contentType != null ? _contentType._name : "<unresolved>")); break; case TCKind._tk_wstring: s.print("wstring[" + _length + "] " + _name); break; case TCKind._tk_fixed: s.print("fixed(" + _digits + ", " + _scale + ") " + _name); break; case TCKind._tk_value_box: s.print("valueBox " + _name + "..."); break; case TCKind._tk_abstract_interface: s.print("abstractInterface " + _name + "..."); break; default: s.print("<unknown type>"); break; } }