@Test public void testSet_optionalIsEmpty() { BasicDto basic = new BasicDto(); SetterUtils.set(basic::setString,Optional.empty()); assertNull("was expecting a null value",basic.getString()); }
public static<T> void set(final Consumer<T> setter, final Optional<T> value) { if(value == null) { setter.accept(null); } else { setter.accept(value.orElse(null)); } }
SetterUtils { public static<T> void set(final Consumer<T> setter, final Optional<T> value) { if(value == null) { setter.accept(null); } else { setter.accept(value.orElse(null)); } } }
SetterUtils { public static<T> void set(final Consumer<T> setter, final Optional<T> value) { if(value == null) { setter.accept(null); } else { setter.accept(value.orElse(null)); } }  }
SetterUtils { public static<T> void set(final Consumer<T> setter, final Optional<T> value) { if(value == null) { setter.accept(null); } else { setter.accept(value.orElse(null)); } }  static void safeSet(final Consumer<T> setter, final Optional<T> value); static void safeSet(final Consumer<T> setter, final Optional<T> value, final Class primitive); static void set(final Consumer<T> setter, final Optional<T> value); }
SetterUtils { public static<T> void set(final Consumer<T> setter, final Optional<T> value) { if(value == null) { setter.accept(null); } else { setter.accept(value.orElse(null)); } }  static void safeSet(final Consumer<T> setter, final Optional<T> value); static void safeSet(final Consumer<T> setter, final Optional<T> value, final Class primitive); static void set(final Consumer<T> setter, final Optional<T> value);  }