Gooey Bean Proxy
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"/>
A part of "Gooey Beans, the GUI part of a trilogy in 42 parts"
Code Snippet
We expose the properties of the presentation model using an interface as follows.
public interface PersonInfo extends GObservableBean {
GProperty<String> username();
GProperty<String> firstNames();
GProperty<String> lastName();
GProperty<String> displayName();
GProperty<String> email();
GProperty<Date> birthday();
GProperty<Date> lastLogin();
GProperty<BigDecimal> score();
GProperty<PersonTitle> title();
GProperty<PersonGender> gender();
GProperty<PersonMaritalStatus> 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.
- Login or register to post comments
- Printer-friendly version
- evanx's blog
- 931 reads





