public static Type getArrayComponentType ( Type type ) { if ( type instanceof GenericArrayType ) { return GenericArrayType . class . cast ( type ) . getGenericComponentType ( ) ; } if ( type instanceof Class < ? > ) { Class < ? > clazz = ( Class < ? > ) type ; if ( clazz . isArray ( ) ) { return clazz . getComponentType ( ) ; } } throw new IllegalArgumentException ( "Not an array type " + type ) ; }
Determines the component type for a given array type .