Michael Donohue
Michael Donohue

Reputation: 11876

Change GWT application behavior between deployed and debug environment

I would like to have my GWT application use different constants when debugging or developing vs when deployed. What is the right way to do this? My web searches turn up a lot of pages about debugging GWT applications, which isn't what I'm looking for.

Upvotes: 1

Views: 239

Answers (1)

Igor Klimer
Igor Klimer

Reputation: 15321

This looks like a job for deferred binding! ;)
It would look something like this (put this in your module XML file, I haven't actually tested it, but you should get the gist of it):

  <define-property name="debug" values="true,false" />
  <set-property name="debug" value="true" />

  <replace-with class="package.Constants">
    <when-type-is class="package.Constants"/>
  </replace-with>

  <replace-with class="package.ConstantsDebug">
    <when-type-is class="package.Constants" />
    <when-property-is name="debug" value="true"/>
  </replace-with>

See the docs for more information on available parameters, rules and whatnot.

Upvotes: 1

Related Questions