Thursday, December 29, 2011

Re: How to get hold of the instance in an InstanceRequest

On Thursday, December 22, 2011 9:04:27 PM UTC+1, Gregor Frey wrote:
Thank you. So there is no way to implement an instance method outside the domain class?

Yes you can: you simply need a ServiceLocator.
But why woulnt I include all instance methods in the proxy definition then? I hoped I could add methods, that are originally not in the domain object, but are needed just for doing data transformations for the UI, in a separate class.

Declare your method as "Request<Result> doSomething(Instance object)" instead of "InstanceRequest<Instance, Result> doSomething()". The former says the method is declared on the class pointed to by the @Service annotation, while the latter bypasses that annotation and tells the method is declared on the class pointed to by the @ProxyFor annotation of the Instance proxy. Obviously, on the server-side, you'd need a "DomainResult doSomething(DomainInstance object)" method in the former case, and a "DomainResult doSomething()" (declared on the DomainInstance class, so "this" will be the instance you passed to using() on the client-side) in the latter case.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment