Nathan,

To some extent you can make this happen by wrapping your method
implementations with GWT.isScript() or GWT.isClient() calls as appropriate.

Another approach is to use super-src so that you in fact have two
implementations of your class, one for the client, one for the server.

I realize neither quite hits the sweet spot you're looking for, but may help
you in a pragmatic sense.

Fred


On Mon, Aug 10, 2009 at 10:10 AM, Nathan Wells <nwwe...@gmail.com> wrote:

>
> I have hesitated to bring this up, since I'm relatively new to GWT,
> and I would hate to waste anyone's time with explaining what is
> hopefully common knowledge to me.
>
> Specifically, I thinking about the DTO problem. I think the general
> opinion about DTOs is that they are a necessary evil when working with
> GWT. And let me say, they are a very minor blemish on a life-saving
> framework. But, It seems to me that the problem has a more elegant
> solution. I would propose that all we need to do is increase the
> granularity of GWT compiler control.
>
> For clarification, I would like to be able to tell the compiler at the
> class member level (either through annotations or *.gwt.xml) what
> should be client-side and what should be server-side. As an example,
> compiling the following class wouldn't be a problem:
>
> class Foo implements Serializable {
>
>  @ServerOnly
>  static long serialVersionUID = 325490285;
>
>  //default, of course compiles to java byte-code and js.
>  String bar;
>
>  @ServerOnly
>  void setBar(String bar) {
>    //a method which might reference un-emulated JRE classes
>  }
>
>  String getBar() {
>    return bar;
>  }
>
> }
>
> I hope that makes sense... that way, our the same class could be used
> on server and client side. Hurray for OO!
>
> Again, I'm sure there are some unforeseen consequences of this design,
> not the least of which is the possibility that it would require
> basically rebuilding the GWT compiler. I'm just hoping that this
> discussion might answer other n00b questions in the future :)
>
> >
>


-- 
Fred Sauer
Developer Advocate
Google Inc. 1600 Amphitheatre Parkway
Mountain View, CA 94043
fre...@google.com

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to