I'm wondering if there is a facility in the gwt compiler to perform a
"replace-with" for classes that aren't gwt client side compliant.

For example, I have 2 implementations of DateFormatterFactory.  One
implementation uses SimpleDateFormat, and the other uses
DateTimeFormat.  As such, when I construct an implementation, I have
to know which side of the wire I'm on, because SimpleDateFormat won't
compile in gwt and DateTimeFormat won't run in the JRE.  Currently, I
have to pass the factory in as a dependency through several layers of
constructors, but it would be nice if I could simply write all of my
code using SimpleDateFormat implementation, and then have the gwt
compiler swap in the gwt client-side implementation at compile time.

Honestly, it could be as simple as a find-replace precompiler step
that replaces all occurrences of
"myproject.server.SimpleDateFormatFactory" with
"myproject.client.DateTimeFormatFactory".  Another solution that could
work, is if you could annotate/comment on a static block or method
such that the gwt compiler would ignore it.

the replace-with tag won't work, because it requires you to use
GWT.create() which doesn't work on the server side.  Also, checking to
see if you're in hosted mode and if not calling "new SimpleDate..." or
"Class.forName..." won't work because the gwt compiler will not
compile a class with those statements.

--~--~---------~--~----~------------~-------~--~----~
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