protected int get_tango_type ( Class type_cl ) throws DevFailed { int type = 0 ; // // For arrays // if ( type_cl . isArray ( ) == true ) { String type_name = type_cl . getComponentType ( ) . getName ( ) ; if ( type_name . equals ( "byte" ) ) type = Tango_DEVVAR_CHARARRAY ; else if ( type_name . equals ( "short" ) ) type = Tango_DEVVAR_SHORTARRAY ; else if ( type_name . equals ( "int" ) ) type = Tango_DEVVAR_LONGARRAY ; else if ( type_name . equals ( "float" ) ) type = Tango_DEVVAR_FLOATARRAY ; else if ( type_name . equals ( "double" ) ) type = Tango_DEVVAR_DOUBLEARRAY ; else if ( type_name . equals ( "java.lang.String" ) ) type = Tango_DEVVAR_STRINGARRAY ; else { StringBuffer mess = new StringBuffer ( "Argument array of " ) ; mess . append ( type_name ) ; mess . append ( " not supported" ) ; Except . throw_exception ( "API_MethodArgument" , mess . toString ( ) , "TemplCommandIn.get_tango_type()" ) ; } } // // For all the other types // else { String type_name = type_cl . getName ( ) ; if ( type_name . equals ( "boolean" ) ) type = Tango_DEV_BOOLEAN ; else if ( type_name . equals ( "short" ) ) type = Tango_DEV_SHORT ; else if ( type_name . equals ( "int" ) ) type = Tango_DEV_LONG ; else if ( type_name . equals ( "long" ) ) type = Tango_DEV_LONG64 ; else if ( type_name . equals ( "float" ) ) type = Tango_DEV_FLOAT ; else if ( type_name . equals ( "double" ) ) type = Tango_DEV_DOUBLE ; else if ( type_name . equals ( "java.lang.String" ) ) type = Tango_DEV_STRING ; else if ( type_name . equals ( "Tango.DevVarLongStringArray" ) ) type = Tango_DEVVAR_LONGSTRINGARRAY ; else if ( type_name . equals ( "Tango.DevVarDoubleStringArray" ) ) type = Tango_DEVVAR_DOUBLESTRINGARRAY ; else if ( type_name . equals ( "Tango.State" ) ) type = Tango_DEV_STATE ; else { StringBuffer mess = new StringBuffer ( "Argument " ) ; mess . append ( type_name ) ; mess . append ( " not supported" ) ; Except . throw_exception ( "API_MethodArgument" , mess . toString ( ) , "TemplCommandIn.get_tango_type()" ) ; } } return type ; }
Get the TANGO type for a command argument .