public static <T>ImmutableList<SonarField<T>> findFieldsWithType(Class<?> clazz,Class<T> fieldType){
  Preconditions.checkNotNull(clazz,"Null class");
  Preconditions.checkNotNull(fieldType,"Null type");
  ImmutableList.Builder<SonarField<T>> builder=ImmutableList.builder();
  for (  Field field : clazz.getDeclaredFields()) {
    if (Reflection.isLenientlyAssignableFrom(fieldType,field.getType())) {
      builder.add(new SonarField<T>(field));
    }
  }
  return builder.build();
}

public static < T > ImmutableList < SonarField < T > > findFieldsWithType ( Class < ? > clazz , Class < T > fieldType ) { Preconditions . checkNotNull ( clazz , "Null class" ) ; Preconditions . checkNotNull ( fieldType , "Null type" ) ; ImmutableList . Builder < SonarField < T > > builder = ImmutableList . builder ( ) ; for ( Field field : clazz . getDeclaredFields ( ) ) { if ( Reflection . isLenientlyAssignableFrom ( fieldType , field . getType ( ) ) ) { builder . add ( new SonarField < T > ( field ) ) ; } } return builder . build ( ) ; }
get the only field in the class with the given type
