Monday, October 27, 2014

Re: Modify the property of an object via Deferred Binding

The reason is that you aren't really creating a new implementation of the logic, so i feel that having to create a class to set a property is a bit redundant/ridiculous.

Yeah maybe my example is a bit off. I think in reality I would have created a configuration interface that has getters for each config value and then provide different implementations of that configuration interface. Then I would pass in that configuration to the real class that contains the logic. IMHO that feels a lot better to me since you don't end up with empty sub classes only to call a super constructor with different parameters. It is also a lot more descriptive.

For such configuration classes, writing a generator is really easy. GWT actually has a generator that kind of does what you want. Take a look at UserAgentGenerator which generates an implementation of UserAgent. The generator code that produces UserAgent.getCompileTimeValue() is exactly what you need to generate a configuration class that simply returns compile time XML property values.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment