I don't think the first form will work... the compiler needs information
based on the method arguments to infer the generic type.
But, yeah... Sun uses that pattern throughout the JDK.
Johan Compagner wrote:
>
> What i could do is add these methods to TextField (for example)
>
> public static final <X> TextField<X> create(String id)
> {
> return new TextField<X>(id);
> }
>
> public static final <X> TextField<X> create(String id, IModel<X>
> model)
> {
> return new TextField<X>(id, model);
> }
>
>
> then i can create TextFields like this:
>
> TextField<String> tfString = TextField.create("foo");
> TextField<Number> tfNumber = TextField.create("bar", new
> Model<Number>());
>
> less generics verbosity :)
>
> johan
>
>
>
> On Thu, May 22, 2008 at 6:04 PM, Martijn Dashorst <
> [EMAIL PROTECTED]> wrote:
>
>> We should move the discussion concerning generics to the dev list.
>> This was proposed several times in the running thread, and from a
>> statistics point of view, the dev list could use some posts :).
>>
>> The process
>>
>> Moving forward I'd like to see (and I think most agree) the following:
>> 1. Wicket 1.4M2 released this weekend
>> 2. A rethought/recapturing of the goals of a generified Wicket (i.e.
>> what are we trying to achieve)
>> 3. A civil [1] discussion concerning the validity of the choices we made
>> 4. A reevaluation of the tremendous effort Igor, Johan and Gerolf put
>> into generics last couple of weeks
>> 5. Participation of the whole community
>> 6. Documentation of the goals, ideas and implementation on a Wiki page
>>
>> The release
>>
>> 1 and 5 should go hand in hand. I'd like to see the release notes
>> specifically ask for feedback, and add a warning that this is under
>> construction. I expect this discussion to last beyond next week.
>>
>> The docs
>>
>> I have created a page in our wiki to capture our ideas and pros and cons:
>>
>> http://cwiki.apache.org/confluence/display/WICKET/generics
>>
>> The page needs filling. I am not attached to the headings, but please
>> leave the notice on top. I can't and won't document this by myself (I
>> have a deadline to catch with a book).
>>
>> The questions
>>
>> Can be asked here.
>>
>> Martijn
>>
>> [1] Where the intelligence of the folks that contribute is not
>> disputed - if someone thinks generics is difficult, doesn't mean the
>> person is stupid (if you think so, fine, but keep that to yourself) I
>> want this discussion to be inclusionary, getting input from everyone.
>> If someone thinks generics are hard, then let him voice that and treat
>> that with respect, even if it concerns Component<Void>
>>
>
>
--
View this message in context:
http://www.nabble.com/-discuss--The-trouble-with-Generics-tp17407572p17416635.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.