public static Class < ? > typeToClass ( Type t ) { if ( t instanceof Class ) { return ( Class < ? > ) t ; } else if ( t instanceof ParameterizedType ) { return ( ( Class < ? > ) ( ( ParameterizedType ) t ) . getRawType ( ) ) ; } throw new IllegalArgumentException ( "Cannot convert type to class" ) ; }
Convert ParameterizedType or Class to a Class .