Re: Custom mapper for mapping entity to rf proxy
On Friday, April 20, 2012 11:44:02 AM UTC+2, -sowdri- wrote:
>> For properties on proxies, you can actually simply mark them with @SkipInterfaceValidationActually the proxy interface is compatible with the entity. Just that for one of the values, rather then using the value in the entity, i want to make a db call to populate the value. That 's why I'm looking for the actual place where this mapping is taking place, such that I can override the default behavior only for this one entity.>> "implement" them in a ServiceLayerDecorator.Can you provide some more details regarding this?
class LoadFromDbServiceLayer extends ServiceLayerDecorator {
@Override
public Object getProperty(Object domainObject, String propertyName) {
if (domainObject instanceof SomeDomainObject && "someProperty".equals(propertyName)) {
// make db call and return the value
}
return super.getProperty(domainObject, propertyName);
}
}
Note that this depends on the domain type, you don't know the proxy type here (as, technically, the same domain object instance can be exposed as 2 distinct proxy instances).
If you want to depend on the proxy type instead, make it "incompatible" with the domain type (change the property name on the proxy and mark it with @SkipInterfaceValidation), so that you can check for that name in the ServiceLayerDecorator.
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/TlrCx9IPV6AJ.
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