Thanks for replies. I found the solution on
http://francisshanahan.com/index.php/2010/a-simple-gwt-generator-example/.
I am going to use generators and SourceWriter to dynamically create
classes based on the interface. This is exactly what I need.

On Jun 9, 12:47 pm, Magno Machado <[email protected]> wrote:
> Isn't it exactly what gwt-rpc does?
>
> 2011/6/8 Michał Jabłoński <[email protected]>
>
>
>
>
>
>
>
>
>
> > I am going to create universal proxy to server object. I want to user
> > call method of class (any kind he creates) on client side which will
> > be calling the same method on server object and return value. Dynamic
> > proxy is exactly what I need.
> > So the only way is to call a class by name?
>
> > Paul Robinson wrote:
> > > No. It's not clear exactly what you're trying to achieve, so it's hard to
> > suggest an alternative. You have almost no reflection available in GWT -
> > almost the only thing you can do is to ask a class for its name. So passing
> > an interface as a parameter is not generally useful.
>
> > > Paul
>
> > > On 08/06/11 12:32, Michał Jabłoński wrote:
> > > > Hi!
>
> > > > It is possible to create dynamic proxy in gwt? I want create library
> > > > which changes behaviour of methods of some class (interface will be
> > > > parameter), for example, when user call method of class implementing
> > > > interface, it will return always String "abc". In java it would be
> > > > something like this:
>
> > > > public class proxyHandler implements InvocationHandler {
> > > >     private Object proxied;
>
> > > >     public proxyHandler(Object proxied) {
> > > >             this.proxied = proxied;
> > > >     }
>
> > > >     public Object invoke(Object proxy, Method method, Object[] args)
> > > >                     throws Throwable {
> > > >             return "abc";
> > > >     }
> > > > }
> > > > ..
> > > >     public static void main(String[] args) {
> > > >             Object object = new Object();
> > > >         Interface proxy = (Interface)Proxy.newProxyInstance(
> > > >           Interface.class.getClassLoader(),
> > > >           new Class[]{ Interface.class },
> > > >           new proxyHandler(object));
> > > >         System.out.println(proxy.getName());
> > > > }
>
> > > > It is possible to do something like this in gwt (using deferred
> > > > binding, whatever)? Thanks for any help
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> Magno Machado 
> Paulohttp://blog.magnomachado.com.brhttp://code.google.com/p/emballo/

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to