Validator.validateProperty is not enough for new collection support

Description

I wrote some JavaSE sample to test the new ValueExtractor classes for JavaFX like ListPropertyValueExtractor. In that case I miss an important feature in the base API.

Let's say I have a model that has the following fields:

1 2 3 4 5 6 7 @NotEmpty(message = "Name sollte nicht leer sein!") private final StringProperty name = new SimpleStringProperty(); private final Property<@Min(50) Integer> count = new SimpleObjectProperty<>(); @Size(min=1, max=4) private final ListProperty<@Size(min=2, max=32) String> tags = new SimpleListProperty<>(FXCollections.observableArrayList());

Next I bind all the properties of the model to UI nodes. Example:

1 nameField.textProperty().bindBidirectional(model.nameProperty());

In addition I want to do a validation call whenever a value in the model changes. For the name property this can be done by the following code:

1 2 3 nameErrorNode.visibleProperty().bind(Bindings.createBooleanBinding(() -> !validator.validateProperty(model, "name").isEmpty(), model.nameProperty()));

By doing it like this only the name property will be validated whenever it changes. It would be wrong to validate the complete model in this case.
I can simply do the same for the list:

1 2 3 tagErrorNode.visibleProperty().bind(Bindings.createBooleanBinding(() -> !validator.validateProperty(model, "tags").isEmpty(), model.tagsProperty()));

In this case the list will be validated whenever the list changes. This happens for example if a new element will be added, updated or removed. Let's imagine a list with 1_000_000 entries or so. In that case I do not want to validate the complete list when I update an element. Based on this I think that an additional method next to

1 Validator.validateProperty()

is needed in the JBV Spec to validate internal elements.

Environment

Java SE 8

Status

Assignee

Unassigned

Reporter

Hendrik Ebbers

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

2.0.0.Beta1

Priority

Major