Voyager ORB

com.objectspace.voyager.corba
Class TypeCode

com.objectspace.voyager.corba.TypeCode

public abstract class TypeCode
implements IConstants, java.io.Serializable

A TypeCode allows runtime access to information about an object's type. It is the CORBA cross-platform equivalent of Java reflection. Although you cannot construct a TypeCode directly, you can obtain an object's or class's typecode using the static getTypeCode() methods. Note that the typecode codes tk_null..tk_fixed are defined in com.objectspace.voyager.corba.IConstants.

Version:
3.0
See Also:
Serialized Form

Method Summary
 TypeCode contentType()
          Return the type of my elements.
 long defaultIndex()
          Return my default index.
 TypeCode discriminatorType()
          Return my discriminator type.
static TypeCode getTypeCode(java.lang.Class type)
          Return the typecode of the specified class.
static TypeCode getTypeCode(java.lang.Object object)
          Return the typecode of the specified object.
 java.lang.String id()
          Return my repository id.
abstract  int kind()
          Return my code (tk_null..tk_fixed).
 int length()
          Return my maximum length.
 int memberCount()
          Return the number of members that I define.
 Any memberLabel(int index)
          Return an Any that describes the specified union label.
 java.lang.String memberName(int index)
          Return the name of the specified member.
 TypeCode memberType(int index)
          Return the typecode of the specified member.
 java.lang.String name()
          Return the name of my interface.
 

Method Detail

kind

public abstract int kind()
Return my code (tk_null..tk_fixed).

id

public java.lang.String id()
                    throws TypeCodeException
Return my repository id.
Throws:
TypeCodeException - My typecode was not tk_objref, tk_struct, tk_union, tk_enum, tk_except, or tk_alias.

name

public java.lang.String name()
                      throws TypeCodeException
Return the name of my interface.
Throws:
TypeCodeException - My typecode was not tk_objref, tk_struct, tk_union, tk_enum, tk_except, or tk_alias.

memberCount

public int memberCount()
                throws TypeCodeException
Return the number of members that I define.
Throws:
TypeCodeException - My typecode was not tk_struct, tk_union, tk_enum, or tk_except.

memberName

public java.lang.String memberName(int index)
                            throws TypeCodeException,
                                   java.lang.ArrayIndexOutOfBoundsException
Return the name of the specified member.
Parameters:
index - The index of the member.
Throws:
TypeCodeException - My typecode was not tk_struct, tk_union, tk_enum, or tk_except.
java.lang.ArrayIndexOutOfBoundsException - The array index was out of bounds.

memberType

public TypeCode memberType(int index)
                    throws TypeCodeException,
                           java.lang.ArrayIndexOutOfBoundsException
Return the typecode of the specified member.
Parameters:
index - The index of the member.
Throws:
TypeCodeException - My typecode was not tk_struct, tk_union, or tk_except.
java.lang.ArrayIndexOutOfBoundsException - The array index was out of bounds.

memberLabel

public Any memberLabel(int index)
                throws TypeCodeException
Return an Any that describes the specified union label.
Parameters:
index - The index of the union label.
Throws:
TypeCodeException - My typecode was not tk_union.

discriminatorType

public TypeCode discriminatorType()
                           throws TypeCodeException
Return my discriminator type.
Throws:
TypeCodeException - My typecode was not tk_union.

defaultIndex

public long defaultIndex()
                  throws TypeCodeException
Return my default index.
Throws:
TypeCodeException - My typecode was not tk_union.

length

public int length()
           throws TypeCodeException
Return my maximum length.
Throws:
TypeCodeException - My typecode was not tk_string, tk_wstring, tk_sequence, or tk_array.

contentType

public TypeCode contentType()
                     throws TypeCodeException
Return the type of my elements.
Throws:
TypeCodeException - My typecode was not tk_string, tk_wstring, tk_sequence, or tk_array.

getTypeCode

public static TypeCode getTypeCode(java.lang.Object object)
Return the typecode of the specified object. Note that the object can be a Struct, Union, Enum, Exception, Any, TypeCode, or regular Object.
Parameters:
object - The object.

getTypeCode

public static TypeCode getTypeCode(java.lang.Class type)
Return the typecode of the specified class. Note that the class can be a Struct, Union, Enum, Exception, Any, TypeCode, or regular Object.
Parameters:
type - The class.

ObjectSpace Inc.

(c) Copyright 1997-1999 ObjectSpace, Inc.
14850 Quorum Drive, Suite 500
Dallas, Texas 75240