Binder.bindInstanceFields with BindingStrategy or BindingPredicate
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 717
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 3
Description
Vaadin version: 8.0.0.beta2
There's a quite common pattern to name fields by appending some sort of field type indicator, for example one might want to bind User.name property to TextField named nameTextField. Currently no name resolution strategy is possible, so we're forced to sync property names with component names.
It should be fairly simple to introduce a notion of optional NameResolutionPredicate, for ex something as simple as below could do in most cases (prefix, ignorecase etc), for ex: this potentially buggy solution to the above:
Binder.bindInstanceFields(this).withBindingPredicate((fieldName, propertyName) -> fieldName.startsWith(propertyName));
and/or a full blown NameResolutionStrategy, to be able to specify more relaxed binding strategies.
Binder.bindInstanceFields(this).withBindingStrategy(ignoreFieldClassNameStrategy);
It would be great if one could specify Application wide defaults for the above.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Binder.bindInstanceFields API and review how field and property names are currently matched. Evaluate the requested BindingPredicate, BindingStrategy, and application-wide defaults against the examples in the issue. Done means the chosen configuration supports alternate naming conventions and has coverage for the matching behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100