|
|
|||||
Evan Summers's BlogGooey Bean ProxyPosted by evanx on July 23, 2007 at 06:39 AM | Comments (0)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.
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.
Bookmark blog post: CommentsComments are listed in date ascending order (oldest first) | Post Comment | |||||
|
|