/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_string(String s) { //debug.log ("insert_string"); // Make sure type code information for bounded strings is not erased if (typeCode.kind() == TCKind.tk_string) { int length = 0; try { length = typeCode.length(); } catch (BadKind bad) { throw wrapper.badkindCannotOccur() ; } // Check if bounded strings length is not exceeded if (length != 0 && s != null && s.length() > length) { throw wrapper.badStringBounds( new Integer(s.length()), new Integer(length) ) ; } } else { typeCode = orb.get_primitive_tc(TCKind._tk_string); } object = s; isInitialized = true; }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_wstring(String s) { //debug.log ("insert_wstring"); // Make sure type code information for bounded strings is not erased if (typeCode.kind() == TCKind.tk_wstring) { int length = 0; try { length = typeCode.length(); } catch (BadKind bad) { throw wrapper.badkindCannotOccur() ; } // Check if bounded strings length is not exceeded if (length != 0 && s != null && s.length() > length) { throw wrapper.badStringBounds( new Integer(s.length()), new Integer(length) ) ; } } else { typeCode = orb.get_primitive_tc(TCKind._tk_wstring); } object = s; isInitialized = true; }
public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type) { try { if (TypeCodeImpl.digits(value) > type.fixed_digits() || TypeCodeImpl.scale(value) > type.fixed_scale()) { throw wrapper.fixedNotMatch() ; } } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) { // type isn't even of kind fixed throw wrapper.fixedBadTypecode( bk ) ; } typeCode = TypeCodeImpl.convertToNative(orb, type); object = value; isInitialized = true; }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
public TypeCode content_type() throws BadKind { switch (_kind) { case tk_indirect: return indirectType().content_type(); case TCKind._tk_sequence: return lazy_content_type(); case TCKind._tk_array: case TCKind._tk_alias: case TCKind._tk_value_box: return _contentType; default: throw new BadKind(); } }
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; }
public void insert_string(String value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (status == STATUS_DESTROYED) { throw wrapper.dynAnyDestroyed() ; } if (any.type().kind().value() != TCKind._tk_string) throw new TypeMismatch(); if (value == null) throw new InvalidValue(); // Throw InvalidValue if this is a bounded string and the length is exceeded try { if (any.type().length() > 0 && any.type().length() < value.length()) throw new InvalidValue(); } catch (BadKind bad) { // impossible } any.insert_string(value); }
public void insert_wstring(String value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (status == STATUS_DESTROYED) { throw wrapper.dynAnyDestroyed() ; } if (any.type().kind().value() != TCKind._tk_wstring) throw new TypeMismatch(); if (value == null) throw new InvalidValue(); // Throw InvalidValue if this is a bounded string and the length is exceeded try { if (any.type().length() > 0 && any.type().length() < value.length()) throw new InvalidValue(); } catch (BadKind bad) { // impossible } any.insert_wstring(value); }
private void writeIDLValue(Serializable object, String repID) { if (object instanceof StreamableValue) { ((StreamableValue)object)._write(parent); } else if (object instanceof CustomValue) { ((CustomValue)object).marshal(parent); } else { BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID); boolean isCustom = false; if (helper instanceof ValueHelper && object instanceof CustomMarshal) { try { if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value) isCustom = true; } catch(BadKind ex) { throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE, ex ) ; } } if (isCustom) ((CustomMarshal)object).marshal(parent); else helper.write_value(parent, object); } }