本文整理汇总了Java中org.omg.CORBA.TypeCode类的典型用法代码示例。如果您正苦于以下问题:Java TypeCode类的具体用法?Java TypeCode怎么用?Java TypeCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeCode类属于org.omg.CORBA包,在下文中一共展示了TypeCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insert_Object
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
/**
* A variant of the insertion operation that takes a typecode
* argument as well.
*/
public void insert_Object(org.omg.CORBA.Object o, TypeCode tc)
{
//debug.log ("insert_Object2");
try {
if ( tc.id().equals("IDL:omg.org/CORBA/Object:1.0") || o._is_a(tc.id()) )
{
typeCode = TypeCodeImpl.convertToNative(orb, tc);
object = o;
}
else {
throw wrapper.insertObjectIncompatible() ;
}
} catch ( Exception ex ) {
throw wrapper.insertObjectFailed(ex) ;
}
isInitialized = true;
}
示例2: insert_fixed
import org.omg.CORBA.TypeCode; //导入依赖的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;
}
示例3: TypeCodeImpl
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
public TypeCodeImpl(ORB orb,
int creationKind,
String id,
String name,
TypeCode original_type)
// for aliases and value boxes
{
this(orb) ;
if ( creationKind == TCKind._tk_alias || creationKind == TCKind._tk_value_box )
{
_kind = creationKind;
setId(id);
_name = name;
_contentType = convertToNative(_orb, original_type);
}
// else initializes to null
}
示例4: insert_Value
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
public void insert_Value(Serializable v)
{
//debug.log ("insert_Value");
object = v;
TypeCode tc;
if ( v == null ) {
tc = orb.get_primitive_tc (TCKind.tk_value);
} else {
// See note in getPrimitiveTypeCodeForClass. We
// have to use the latest type code fixes in this
// case since there is no way to know what ORB will
// actually send this Any. In RMI-IIOP, when using
// Util.writeAny, we can do the versioning correctly,
// and use the insert_Value(Serializable, TypeCode)
// method.
//
// The ORB singleton uses the latest version.
tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init());
}
typeCode = TypeCodeImpl.convertToNative(orb, tc);
isInitialized = true;
}
示例5: member_type
import org.omg.CORBA.TypeCode; //导入依赖的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();
}
}
示例6: createTypeCodeForClassInternal
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
private static TypeCode createTypeCodeForClassInternal (ORB orb,
java.lang.Class c,
ValueHandler vh,
IdentityKeyValueStack createdIDs)
{
// This wrapper method is the protection against infinite recursion.
TypeCode tc = null;
String id = (String)createdIDs.get(c);
if (id != null) {
return orb.create_recursive_tc(id);
} else {
id = vh.getRMIRepositoryID(c);
if (id == null) id = "";
// cache the rep id BEFORE creating a new typecode.
// so that recursive tc can look up the rep id.
createdIDs.push(c, id);
tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
createdIDs.pop();
return tc;
}
}
示例7: createTypeCode
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
/**
* When using our own ORB and Any implementations, we need to get
* the ORB version and create the type code appropriately. This is
* to overcome a bug in which the JDK 1.3.x ORBs used a tk_char
* rather than a tk_wchar to describe a Java char field.
*
* This only works in RMI-IIOP with Util.writeAny since we actually
* know what ORB and stream we're writing with when we insert
* the value.
*
* Returns null if it wasn't possible to create the TypeCode (means
* it wasn't our ORB or Any implementation).
*
* This does not handle null objs.
*/
private TypeCode createTypeCode(Serializable obj,
org.omg.CORBA.Any any,
org.omg.CORBA.ORB orb) {
if (any instanceof com.sun.corba.se.impl.corba.AnyImpl &&
orb instanceof ORB) {
com.sun.corba.se.impl.corba.AnyImpl anyImpl
= (com.sun.corba.se.impl.corba.AnyImpl)any;
ORB ourORB = (ORB)orb;
return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB);
} else
return null;
}
示例8: createTypeCodeForNull
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
/**
* This is used to create the TypeCode for a null reference.
* It also handles backwards compatibility with JDK 1.3.x.
*
* This method will not return null.
*/
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
if (orb instanceof ORB) {
ORB ourORB = (ORB)orb;
// Preserve backwards compatibility with Kestrel and Ladybird
// by not fully implementing interop issue resolution 3857,
// and returning a null TypeCode with a tk_value TCKind.
// If we're not talking to Kestrel or Ladybird, fall through
// to the abstract interface case (also used for foreign ORBs).
if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {
return orb.get_primitive_tc(TCKind.tk_value);
}
}
// Use tk_abstract_interface as detailed in the resolution
// REVISIT: Define this in IDL and get the ID in generated code
String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";
return orb.create_abstract_interface_tc(abstractBaseID, "");
}
示例9: content_type
import org.omg.CORBA.TypeCode; //导入依赖的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();
}
}
示例10: getPrimitiveTypeCodeForClass
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
Class c,
ValueHandler vh) {
if (c == Integer.TYPE) {
return orb.get_primitive_tc (TCKind.tk_long);
} else if (c == Byte.TYPE) {
return orb.get_primitive_tc (TCKind.tk_octet);
} else if (c == Long.TYPE) {
return orb.get_primitive_tc (TCKind.tk_longlong);
} else if (c == Float.TYPE) {
return orb.get_primitive_tc (TCKind.tk_float);
} else if (c == Double.TYPE) {
return orb.get_primitive_tc (TCKind.tk_double);
} else if (c == Short.TYPE) {
return orb.get_primitive_tc (TCKind.tk_short);
} else if (c == Character.TYPE) {
return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
} else if (c == Boolean.TYPE) {
return orb.get_primitive_tc (TCKind.tk_boolean);
} else {
// _REVISIT_ Not sure if this is right.
return orb.get_primitive_tc (TCKind.tk_any);
}
}
示例11: type
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
/**
* sets the type of the element to be contained in the Any.
*
* @param tc the TypeCode for the element in the Any
*/
public void type(TypeCode tc)
{
//debug.log ("type2");
// set the typecode
typeCode = TypeCodeImpl.convertToNative(orb, tc);
stream = null;
value = 0;
object = null;
// null is the only legal value this Any can have after resetting the type code
isInitialized = (tc.kind().value() == TCKind._tk_null);
}
示例12: insert_TypeCode
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
/**
* See the description of the <a href="#anyOps">general Any operations.</a>
*/
public void insert_TypeCode(TypeCode tc)
{
//debug.log ("insert_TypeCode");
typeCode = orb.get_primitive_tc(TCKind._tk_TypeCode);
object = tc;
isInitialized = true;
}
示例13: extract_TypeCode
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
/**
* See the description of the <a href="#anyOps">general Any operations.</a>
*/
public TypeCode extract_TypeCode()
{
//debug.log ("extract_TypeCode");
checkExtractBadOperation( TCKind._tk_TypeCode ) ;
return (TypeCode)object;
}
示例14: createTypeCodeForClass
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
public static TypeCode createTypeCodeForClass (ORB orb, java.lang.Class c, ValueHandler vh) {
// Maps classes to repositoryIDs strings. This is used to detect recursive types.
IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
// Stores all types created for resolving indirect types at the end.
TypeCode tc = createTypeCodeForClassInternal(orb, c, vh, createdIDs);
return tc;
}
示例15: item
import org.omg.CORBA.TypeCode; //导入依赖的package包/类
public TypeCode item(int index)
throws Bounds
{
try {
return (TypeCode) _exceptions.elementAt(index);
} catch (ArrayIndexOutOfBoundsException e) {
throw new Bounds();
}
}