RequestFactory / AutoBean with non-bean value type
I would like to use a value type for a bean property in an EntityProxy
that is not natively supported by RequestFactory. In other words, a
java type not in com.google.web.bindery.autobean.shared.ValueCodex
(Enum, BigInteger, BigDecimal, Date, etc.).
http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html#transportable
The specific use case I have is using Joda-time types (Duration,
Instant, etc.). ValueProxy won't work for these as they do not
conform to JavaBean conventions.
Is this possible? It doesn't appear to be given the current factoring
of the code.
What would be the best workaround? I toyed with the idea of declaring
these properties as Strings in my EntityProxy interface and then
converting them in a crosscutting manner using ServiceLayerDecorator.
i.e.
Object getProperty(Object domainObject, String property) {
Object value = super.getProperty(domainObject, property);
if (value instanceof JodaDuration) {
// ... convert to String
return ...;
} else {
return value;
}
}
In this way the domain objects would use the native Joda type but the
EntityProxy objects would talk in terms of Strings.
Would this work? Any better ideas?
Thanks,
Eric
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home