@Test void forFieldOfWrongTypeMethodThrows() { calling(() -> Setter.forField(SetterTestClass.class, String.class, ClassUtil.getDeclaredField(SetterTestClass.class, "optionalBigDecimal"))) .shouldThrow(IllegalArgumentException.class) .withMessage(is("Cannot convert void com.cadenzauk.core.reflect.SetterTest$SetterTestClass.setOptionalBigDecimal(java.util.Optional) into " + "a BiConsumer<class com.cadenzauk.core.reflect.SetterTest$SetterTestClass,Optional<class java.lang.String>>.")); }
@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);  }