Martijn, I hope a new feature called "type inference" coming in JDK7 could help java devs to omit repetitive typing of generic parameters.
And another good news - JDK 7 will do provide closures. Martijn Dashorst wrote: > > I hate repeating myself and being the compiler's teacher. IMHO the > generics that are implemented in Java resulted in terrible code where > you have to repeat yourself over and over and over. Are you sure your > text field holds a String and your model returns a String? > > TextField<String> field = new TextField<String>("someId", new > PropertyModel<String>(foo, "property")); > > This counts for 3 times the type String. In a recent discussion with > Igor on ##wicket, we saw a way to remove at least 1 String. By > providing model factory methods for concrete models: Model, > CompoundPropertyModel and PropertyModel. For abstract models it > doesn't make sense... > > Igor suggested the following syntax: > > TextField<String> field = new TextField<String>("someId", > PropertyModel.of(foo, "property")); > > i.e. ModelType.of(....) > > I am +1 for adding these methods. > > We can do the same for components, although the benefit is typically > less, and it might even send our users down the wrong path thinking > they can't use the 'new' keyword. > > TextField<String> field = TextField.of("someId", PropertyModel.of(foo, > "property")); > > WDYT? > > Martijn > -- > Become a Wicket expert, learn from the best: http://wicketinaction.com > Apache Wicket 1.4 increases type safety for web applications > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0 > > -- View this message in context: http://old.nabble.com/Cutting-down-on-the-repetitive-type-identifiers-for-generics-tp26361334p26623904.html Sent from the Wicket - Dev mailing list archive at Nabble.com.