jp.go.aist.rtm.RTC.util
Class TypeCast<T>

java.lang.Object
  extended by jp.go.aist.rtm.RTC.util.TypeCast<T>

public class TypeCast<T>
extends java.lang.Object

It is a utility class that converts the type as for various data types/Any type.


Constructor Summary
TypeCast(java.lang.Class<T> klass)
           Constructor
 
Method Summary
 org.omg.CORBA.Any castAny(T data)
           Cconverts the data of DataType type into the data of Any type
 T castType(org.omg.CORBA.Any data)
           Converts the data of Any type into DataType type
 T castType(org.omg.CORBA.Object obj)
           Converts the data into T type
 java.lang.String getDataTypeCodeName()
           Gets the name of the data type specified by the type parameter of Generics
static java.lang.String getDataTypeCodeName(java.lang.Class klass)
           Gets the data type name of the class corresponding to the specified Class object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeCast

public TypeCast(java.lang.Class<T> klass)
Constructor

Parameters:
klass - class object
Method Detail

castType

public T castType(org.omg.CORBA.Any data)
Converts the data of Any type into DataType type

Parameters:
data - data
Returns:
Converted data
Throws:
java.lang.ClassCastException - Filed in conversion

castType

public T castType(org.omg.CORBA.Object obj)
           throws java.lang.ClassNotFoundException,
                  java.lang.SecurityException,
                  java.lang.NoSuchMethodException,
                  java.lang.IllegalArgumentException,
                  java.lang.IllegalAccessException,
                  java.lang.reflect.InvocationTargetException
Converts the data into T type

Parameters:
obj - data
Returns:
Converted data
Throws:
java.lang.ClassNotFoundException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

castAny

public org.omg.CORBA.Any castAny(T data)
Cconverts the data of DataType type into the data of Any type

Parameters:
data - data
Returns:
Converted data
Throws:
java.lang.ClassCastException - Filed in conversion

getDataTypeCodeName

public static java.lang.String getDataTypeCodeName(java.lang.Class klass)
Gets the data type name of the class corresponding to the specified Class object

Parameters:
klass - Class object
Returns:
Data type name of class

getDataTypeCodeName

public java.lang.String getDataTypeCodeName()
Gets the name of the data type specified by the type parameter of Generics

Returns:
Name of data type specified by type parameter of Generics