public static boolean isFieldParameterizedWithClass ( final Field field , final Class c ) { if ( field . getGenericType ( ) instanceof ParameterizedType ) { final ParameterizedType genericType = ( ParameterizedType ) field . getGenericType ( ) ; for ( final Type type : genericType . getActualTypeArguments ( ) ) { if ( type == c ) { return true ; } if ( c . isInterface ( ) && implementsInterface ( ( Class ) type , c ) ) { return true ; } } } return false ; }
Check if a field is parameterized with a specific class .