There's sometimes an important difference between the kind of object model
that is appropriate to send to the client and one you'd use on the server.
That's the reason we haven't historically tried to make it easier to do
"no-brainer" sharing of server-side object models to the client (i.e.
because it seems likely on average there would be way too much wasted data
transferred, which would lead to slowness). Clearly, you see that issue,
too, based on your suggestion.
How well would the "transient" keyword or the @GwtTransient annotation
satisfy the use case you gave?

On Mon, Aug 10, 2009 at 1:10 PM, 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 :)
>
> >
>

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

Reply via email to