Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT - Mark parts of shared code as "server only"

Tags:

java

gwt

I have a GWT app which contains, besides traditional "client" and "server" packages, also a "shared" package, which contains POJO DTOs that travel back/forth through RPC. I need to create some methods in those DTOs which should exist only on server-side (i.e. they should not be compiled to JS, because they'd use code which is not compile-able to JS), especially the static() method.

Is this possible in GWT (some attribute, ifdef, ...)?

Background: I have some generic validators which require "registration" of the class to be validated (via a static method register(Class<T>), and since I can't find any GWT init() method I'd put the registration in static constructors of the DTOs, so when (if) the class gets loaded it registers itself for validation.

like image 292
Boris B. Avatar asked Dec 06 '25 14:12

Boris B.


1 Answers

A detailed discussion of this issue:

http://code.google.com/p/google-web-toolkit/issues/detail?id=3769

like image 136
Andrei Volgin Avatar answered Dec 08 '25 04:12

Andrei Volgin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!