Hi all, I've been getting my head around DI/gin/guice lately.... Here is a really simple widget:
public class UserForm extends DynamicForm implements UserFormInterface { private TextItem txtUsername; private TextItem txtFirstname; private TextItem txtSurname; @Inject private UserForm(TextItem txtUsername, TextItem txtFirstname, TextItem txtSurname) { this.txtUsername = txtUsername; this.txtFirstname = txtFirstname; this.txtSurname = txtSurname; this.txtUsername.setTitle("Username"); this.txtFirstname.setTitle("Firstname"); this.txtSurname.setTitle("Surname"); this.setShowEdges(true); this.setFields(this.txtUsername, this.txtFirstname, this.txtSurname); } @Override public String getUsername() { return txtUsername.getValueAsString(); } @Override public String getFirstname() { return txtFirstname.getValueAsString(); } @Override public String getSurname() { return txtSurname.getValueAsString(); } } public interface UserFormInterface { String getUsername(); String getFirstname(); String getSurname(); void draw(); } ginjector: @GinModules(MyWidgetClientModule.class) public interface MyWidgetGinjector extends Ginjector { UserFormInterface getUserForm(); } And module: public class MyWidgetClientModule extends AbstractGinModule { @Override protected void configure() { bind(UserFormInterface.class).to(UserForm.class).in(Singleton.class); } } In such simple cases (eg, when coding a composite widget), is there any point in using GIN? Where would one draw the line and say 'oh I really should've done it the other way instead?' -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.