Skip to main content

Gooey Bean Proxy

Posted by evanx on July 23, 2007 at 6:39 AM PDT

We expose a "presentation model" bean using an interface, used to create a dynamic proxy,
with a backing Map of property/values eg. for GUI prototyping, or otherwise a java.bean.

href="https://aptframework.dev.java.net/gooey/beanProxy.html">
align="left" hspace="8"/>

Click here to read "Gooey Bean Proxy"

A part of "Gooey Beans, the GUI part of a trilogy in 42 parts"

style="text-decoration: none;">



Code Snippet

We expose the properties of the presentation model using an interface as follows.

public interface PersonInfo extends GObservableBean {
    GProperty username();
    GProperty firstNames();
    GProperty lastName();
    GProperty displayName();
    GProperty email();
    GProperty birthday();
    GProperty lastLogin();
    GProperty score();
    GProperty title();
    GProperty gender();
    GProperty maritalStatus();
}

In this case, we can use "dynamic proxies" (from java.lang.reflect), to access our bean
properties, rather than looking them up using string literal references eg. via BeanInfo.
Our proxy object will use the Method name to look up the property.

Also, we have the option of not creating a backing bean for starters, which lends itself
towards rapid prototyping, since the above property interface is clearly quite concise.


style="text-decoration: none;">


style="text-decoration: none;">
style="text-decoration: none;">
Related Topics >>