本文整理汇总了Java中org.omg.CORBA.TypeCodePackage.BadKind类的典型用法代码示例。如果您正苦于以下问题:Java BadKind类的具体用法?Java BadKind怎么用?Java BadKind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BadKind类属于org.omg.CORBA.TypeCodePackage包,在下文中一共展示了BadKind类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insert_string
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
/**
* 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;
}
示例2: insert_wstring
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
/**
* 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;
}
示例3: insert_fixed
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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;
}
示例4: id
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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();
}
}
示例5: name
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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();
}
}
示例6: member_count
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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();
}
}
示例7: member_name
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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();
}
}
示例8: member_type
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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();
}
}
示例9: member_label
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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();
}
}
示例10: content_type
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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();
}
}
示例11: currentUnionMemberIndex
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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;
}
示例12: insert_string
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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);
}
示例13: insert_wstring
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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);
}
示例14: writeIDLValue
import org.omg.CORBA.TypeCodePackage.BadKind; //导入依赖的package包/类
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);
}
}