public static String simpleASName (Class<?> clazz)
    {
        if (clazz.isArray()) {
            Class<?> compoType = clazz.getComponentType();
            if (Byte.TYPE.equals(compoType)) {
                return "ByteArray";
            } else if (Object.class.equals(compoType)) {
                return "Array";
            } else {
                return "TypedArray /* of " + compoType + " */";
            }
        } else if (clazz == Boolean.TYPE) {
            return "Boolean";
        } else if (clazz == Byte.TYPE || clazz == Character.TYPE ||
                   clazz == Short.TYPE || clazz == Integer.TYPE) {
            return "int";
        } else if (clazz == Long.TYPE) {
            return "Long";
        } else if (clazz == Float.TYPE || clazz == Double.TYPE) {
            return "Number";
        } else {
            String cname = clazz.getName();
            Package pkg = clazz.getPackage();
            int offset = (pkg == null) ? 0 : pkg.getName().length()+1;
            String name = cname.substring(offset);
            return name.replace('$', '_');
        }
    }
public static String simpleASName ( Class < ? > clazz ) { if ( clazz . isArray ( ) ) { Class < ? > compoType = clazz . getComponentType ( ) ; if ( Byte . TYPE . equals ( compoType ) ) { return "ByteArray" ; } else if ( Object . class . equals ( compoType ) ) { return "Array" ; } else { return "TypedArray /* of " + compoType + " */" ; } } else if ( clazz == Boolean . TYPE ) { return "Boolean" ; } else if ( clazz == Byte . TYPE || clazz == Character . TYPE || clazz == Short . TYPE || clazz == Integer . TYPE ) { return "int" ; } else if ( clazz == Long . TYPE ) { return "Long" ; } else if ( clazz == Float . TYPE || clazz == Double . TYPE ) { return "Number" ; } else { String cname = clazz . getName ( ) ; Package pkg = clazz . getPackage ( ) ; int offset = ( pkg == null ) ? 0 : pkg . getName ( ) . length ( ) + 1 ; String name = cname . substring ( offset ) ; return name . replace ( '$' , '_' ) ; } }
Returns the name of the supplied class as it would appear in ActionScript code using the
class (no package prefix, arrays specified as Array<code>Array</code>).