private static Class < ? > searchIntoParameterzedType ( final Type superType , final Class < ? > typeSearched ) { if ( superType instanceof ParameterizedType ) { for ( final Type genericType : ( ( ParameterizedType ) superType ) . getActualTypeArguments ( ) ) { if ( genericType instanceof Class < ? > && typeSearched . isAssignableFrom ( ( Class < ? > ) genericType ) ) { return ( Class < ? > ) genericType ; } else if ( genericType instanceof ParameterizedType && typeSearched . isAssignableFrom ( ( Class < ? > ) ( ( ParameterizedType ) genericType ) . getRawType ( ) ) ) { return ( Class < ? > ) ( ( ParameterizedType ) genericType ) . getRawType ( ) ; } } } return null ; }
Extract the searched type from a ParamterizedType .