public static Class < ? > rawClassOf ( Type type ) { if ( type instanceof Class < ? > ) { return ( Class < ? > ) type ; } else if ( type instanceof ParameterizedType ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; Type rawType = parameterizedType . getRawType ( ) ; return ( Class < ? > ) rawType ; } else if ( type instanceof GenericArrayType ) { Type componentType = ( ( GenericArrayType ) type ) . getGenericComponentType ( ) ; return Array . newInstance ( rawClassOf ( componentType ) , 0 ) . getClass ( ) ; } else if ( type instanceof TypeVariable ) { return Object . class ; } else { throw new IllegalArgumentException ( "Unsupported type " + type . getTypeName ( ) ) ; } }
Returns the raw class of the specified type .