It would be awesome if the gwt compiler would support something along these lines:<replace-with class="com.my.FavoriteImplementation"> <when-type-is class="com.SomeInterface"/><set-object-property type="boolean" value="false" name="turnFeatureOn"/><set-object-property type="string" value="MyPrimaryStyle" name="defaultStyle"/><set-object-property name="complexProperty" provider="com.my.ComplexPropertyProvider"/> </replace-with>This might actually reduce the need for custom generators and make customization via GWT.create a bit more powerful.
What about:
public abstract class AbstractImplementation implements SomeInterface {
public AbstractImplementation(boolean turnFeatureOn, String defaultStyle, ComplexProperty complexProperty) {
// store as fields
}
}
public class FavoriteImplementation extends AbstractImplementation {
public FavoriteImplementation() {
super(false, "MyPrimaryStyle", new DefaultComplexProperty);
}
}
public class SometimesDifferentImplementation extends AbstractImplementation {
public FavoriteImplementation() {
super(true, "MySecondaryStyle", new CustomComplexProperty);
}
}
<replace-with class="com.my.FavoriteImplementation">
<when-type-is class="com.SomeInterface"/>
</replace-with>
<replace-with class="com.my.SometimesDifferentImplementation">
<when-type-is class="com.SomeInterface"/>
<when-property-is name="sometimes" value="different" />
</replace-with>
-- 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