@Test public void test() { IntegerProperty src = new SimpleIntegerProperty(0); IntegerBinding twice = src.multiply(2); Var<Number> twiceVar = Var.fromVal(twice, n -> src.set(n.intValue() / 2)); List<Number> values = new ArrayList<>(); EventStreams.valuesOf(twiceVar).subscribe(values::add); src.set(1); twiceVar.setValue(4); twiceVar.setValue(5); twiceVar.setValue(7); assertEquals(Arrays.asList(0, 2, 4, 6), values); }
@Override public void setValue(T value) { setter.accept(value); }
VarFromVal extends ProxyVal<T, T> implements Var<T> { @Override public void setValue(T value) { setter.accept(value); } }
VarFromVal extends ProxyVal<T, T> implements Var<T> { @Override public void setValue(T value) { setter.accept(value); } VarFromVal(Val<T> underlying, Consumer<T> setter); }
VarFromVal extends ProxyVal<T, T> implements Var<T> { @Override public void setValue(T value) { setter.accept(value); } VarFromVal(Val<T> underlying, Consumer<T> setter); @Override T getValue(); @Override void bind(ObservableValue<? extends T> observable); @Override void unbind(); @Override boolean isBound(); @Override void setValue(T value); }
VarFromVal extends ProxyVal<T, T> implements Var<T> { @Override public void setValue(T value) { setter.accept(value); } VarFromVal(Val<T> underlying, Consumer<T> setter); @Override T getValue(); @Override void bind(ObservableValue<? extends T> observable); @Override void unbind(); @Override boolean isBound(); @Override void setValue(T value);  }