Description
Description
In order to bind to/from a nesting's inner property it is currently necessary to first create a nested property and then bind to/from that one:
NestedStringProperty currentEmployeesAddress = Nestings.on(currentEmployee)
.nestProperty(employee -> employee.addressProperty())
.nestStringProperty(address -> address.streetNameProperty())
.buildProperty();
streetNameField.textProperty().bindBidirectional(currentEmployeesAddress);
The following would be more succinct:
Nestings.on(currentEmployee)
.nestProperty(employee -> employee.addressProperty())
.nestStringProperty(address -> address.streetNameProperty())
.boundBidirectionallyFrom(streetNameField.textProperty());
Implementation
Depending on the kind of binding such methods would most likely be added to either AbstractNestingBuilderOnObservableValue
(unidirectional) or AbstractNestingBuilderOnProperty
(bidirectional).
But an implementation should consider the possibility that the user or other libraries (or this one) might provide additional kinds of bindings. This means that it would not suffice to "simply" hardcode all currently existing bindings from JavaFX 8 into the above mentioned classes (besides being a ****load of work).
Perhaps it is possible to conceive a more general approach to creating bindings which allows to easily access new kinds of bindings (e.g. via a binding factory).