Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [riena-dev] 264325 - NoSuchMethodException and POJOs

Hi Elias,

couldn't we switch to PojoObservables internally? (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=263031 )

Greetings,
Carsten

> -----Ursprüngliche Nachricht-----
> Von: riena-dev-bounces@xxxxxxxxxxx [mailto:riena-dev-
> bounces@xxxxxxxxxxx] Im Auftrag von Elias Volanakis
> Gesendet: Samstag, 21. Februar 2009 02:50
> An: riena-dev@xxxxxxxxxxx
> Betreff: [riena-dev] 264325 - NoSuchMethodException and POJOs
>
> Just a quick heads-up:
>
> The 3.5 databinding is more strict and will throw
> NoSuchMethodException when using BeanObservables with a POJO (i.e. a
> class that does not accept property change listeners). The exception
> usually does not cause any harm, however it is written to the log. The
> solution is very easy. Use PojoObservables instead:
>
> Exception:
>
> !MESSAGE Could not attach listener to
> org.eclipse.riena.example.client.controllers.SharedViewDemoSubModuleCon
> troller$TxtBean@1a1a1c6
> !STACK 0
> java.lang.NoSuchMethodException:
> org.eclipse.riena.example.client.controllers.SharedViewDemoSubModuleCon
> troller$TxtBean.addPropertyChangeListener(java.beans.PropertyChangeList
> ener)
>         at java.lang.Class.getMethod(Class.java:1605)
>         at
> org.eclipse.core.internal.databinding.beans.BeanPropertyListenerSupport
> .processListener(BeanPropertyListenerSupport.java:96)
> [...]
>
> Problem:
>
> TxtBean bean = new TxtBean();
> // TxtBean is actually NOT a bean - its a POJO.
> // bindToModel uses BeansObservables.observeValue(bean, "txt")
> internaly because it expects a bean
> // => exception
> labelFacade.bindToModel(bean, "txt");
>
> Solution:
>
> // use this variant of bindToModel together with PojoObservables:
> labelFacade.bindToModel(PojoObservables.observeValue(bean, "txt"))
>
> Hope this helps,
> Elias.
>
> PS: No need to do anything in the Examples. I'm taking care of this...
> _______________________________________________
> riena-dev mailing list
> riena-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/riena-dev


Back to the top