Hello,

I do it like this:

public interface IMyObject{
  public int getA();

  public int getB();
}

public class MyObject implements IMyObject{
  ....
}

public interface MyObjectProxy extends EntityProxy,IMyObject{
  ...
}

public static int sum(IMyObject domain){
   return domain.getA() + domain.getB();
}


On Feb 11, 9:44 pm, Sydney <sydney.henr...@gmail.com> wrote:
> Hello,
>
> I want to run the same method on the client and server side. The reason is
> that the user can call that method when interacting with the UI, but the
> same method can also be called at a later time by a Task on the server
> side. I already wrote the method using the proxy object. I wanted to know
> if there is a way to call the same method on the server side (no proxy)
> without duplicating the code.
>
> What is the best practice?
>
> Example:
>
> MyObject is a domain object in the server package
> MyObjectProxy is the proxy for MyObject
>
> The method that uses the proxies called on the client side.
> public static int sum(MyObjectProxy proxy) {
>   return proxy.getA() + proxy.getB();
>
> }
>
> I want the same method but for the server side with the following signature:
> public static int sum(MyObject domain) {
>   return domain.getA() + domain.getB();
>
> }
>
> Thanks

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to