Property implements BiConsumer<Object, T>, Function<Object, Optional<T>> { @Override public Optional<T> apply(final Object s) { return getter.flatMap(f -> Optional.ofNullable(f.apply(s))); } Property(
      @NotNull final Optional<Function<Object, T>> getter,
      @NotNull final Optional<BiConsumer<Object, T>> setter,
      @NotNull final boolean requiresDataContext); boolean requiresDataContext(); @Override void accept(final Object s, final T t); @Override Optional<T> apply(final Object s);  }
@Parameters({ "input", "anotherInput" }) @Test public void apply(String input) { final VariableHolder holder = new VariableHolder(""); final Property<String> target = new Property<>(Optional.empty(), Optional.of((Object c, String o) -> holder.setValue(o)), false); Assert.assertEquals("", holder.getValue()); target.accept(new Object(), input); Assert.assertEquals(input, holder.getValue()); }