Suppose there is a typical Java Bean:
class MyBean {
void setA(String id) {
}
void setB(String id) {
}
List<String> getList() {
}
}
And I would like to create a more abstract way of calling the setters with the help of a BiConsumer:
Map<SomeEnum, BiConsumer<MyBean, String>> map = ...
map.put(SomeEnum.A, MyBean::setA);
map.put(SomeEnum.B, MyBean::setB);
map.put(SomeEnum.List, (myBean, id) -> myBean.getList().add(id));
Is there a way to replace the lambda (myBean, id) -> myBean.getList().add(id)
with a chained method reference, something like (myBean.getList())::add
or myBean::getList::add
or something else?