rucko24
(Rubén Espinoza)
November 13, 2019, 4:13pm
1
Hello,
Is there a possibility to use an immutable bean with a Binder<> ? that is, without setters for example, the problem lies when using the .bind() method, what setters need.
Binding<BEAN, TARGET> bind(ValueProvider<BEAN, TARGET> getter, Setter<BEAN, TARGET> setter);
ollit.1
(Olli Tietäväinen)
November 14, 2019, 6:56am
2
You can use a Lambda expression for both the ValueProvider and Setter implementations. So you can have something like
.bind(bean -> bean.getValue(), (bean, value) -> { /* do nothing */ });
to not write anything when the setter is called.
rucko24
(Rubén Espinoza)
November 14, 2019, 1:22pm
3
Olli Tietäväinen:
You can use a Lambda expression for both the ValueProvider and Setter implementations. So you can have something like
.bind(bean -> bean.getValue(), (bean, value) -> { /* do nothing */ });
to not write anything when the setter is called.
Works perfectly, thanks a lot Olli.