@Test void forFieldOfWrongTypeFieldThrows() { calling(() -> Setter.forField(SetterTestClass.class, Integer.class, ClassUtil.getDeclaredField(SetterTestClass.class, "string"))) .shouldThrow(IllegalArgumentException.class) .withMessage(is("Cannot convert private java.lang.String com.cadenzauk.core.reflect.SetterTest$SetterTestClass.string into " + "a BiConsumer<class com.cadenzauk.core.reflect.SetterTest$SetterTestClass,Optional<class java.lang.Integer>>.")); }
@SuppressWarnings("unchecked") public static <T, V> BiConsumer<T, Optional<V>> forField(TypeToken<T> targetClass, Class<V> argType, Field field) { return forField((Class<T>) targetClass.getRawType(), argType, field); }
Setter extends UtilityClass { @SuppressWarnings("unchecked") public static <T, V> BiConsumer<T, Optional<V>> forField(TypeToken<T> targetClass, Class<V> argType, Field field) { return forField((Class<T>) targetClass.getRawType(), argType, field); } }
Setter extends UtilityClass { @SuppressWarnings("unchecked") public static <T, V> BiConsumer<T, Optional<V>> forField(TypeToken<T> targetClass, Class<V> argType, Field field) { return forField((Class<T>) targetClass.getRawType(), argType, field); }  }
Setter extends UtilityClass { @SuppressWarnings("unchecked") public static <T, V> BiConsumer<T, Optional<V>> forField(TypeToken<T> targetClass, Class<V> argType, Field field) { return forField((Class<T>) targetClass.getRawType(), argType, field); }  @SuppressWarnings("unchecked") static BiConsumer<T, Optional<V>> forField(TypeToken<T> targetClass, Class<V> argType, Field field); static BiConsumer<T, Optional<V>> forField(Class<T> targetClass, Class<V> argType, Field field); }
Setter extends UtilityClass { @SuppressWarnings("unchecked") public static <T, V> BiConsumer<T, Optional<V>> forField(TypeToken<T> targetClass, Class<V> argType, Field field) { return forField((Class<T>) targetClass.getRawType(), argType, field); }  @SuppressWarnings("unchecked") static BiConsumer<T, Optional<V>> forField(TypeToken<T> targetClass, Class<V> argType, Field field); static BiConsumer<T, Optional<V>> forField(Class<T> targetClass, Class<V> argType, Field field);  }