Or use wicket as I explained on this page :)

http://java.dzone.com/articles/faster-development-easywicket







________________________________
From: James Carman <jcar...@carmanconsulting.com>
To: users@wicket.apache.org
Sent: Fri, April 16, 2010 2:05:12 PM
Subject: Re: Type Inference for Wicket 1.4

And, nothing is stopping you from doing something like this in your
own code.  I have a class called ComponentUtils where I put stuff like
this.  I have two methods:

public static <T extends Serializable> IModel<T> modelOf(T bean);
public static <T extends Serializable> IModel<T> modelFor(Class<T>
beanClass); // This will instantiate the object for you.

I also have:

public static void detachAllModelFields(Component c);

With static imports, you can just use these methods like they're in
your classes.

On Fri, Apr 16, 2010 at 1:21 AM, Jeremy Thomerson
<jer...@wickettraining.com> wrote:
> This is the key - and it has been discussed before (in the many grueling 1.4
> conversations).  The short of it is that with private constructors there's a
> huge change and an inability to extend.  And without the private
> constructors, the static methods are dumb and extraneous because you would
> need hundreds of them, and you would need even more of them on your extended
> model and component classes.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Thu, Apr 15, 2010 at 8:51 AM, Thomas Kappler
> <thomas.kapp...@isb-sib.ch>wrote:
>
>> On 04/15/10 13:06, James Perry wrote:
>>
>>> I can sympathise with that. However I don't think it would be a
>>> maintenance nightmare if the constructors are set to private; but that
>>> would mean a dramatic API change for such convenience and I'm guessing
>>> you're not willing to do this.
>>>
>>
>> Apart from the huge change for questionable benefit, that would also remove
>> inheritance, which is essential to the Wicket way, because you can't extend
>> a class with private constructors only. If you can, get a hold of Bloch,
>> Effective Java, and read the insightful chapter on the constructor vs.
>> static factory method trade-off.
>>
>> -- Thomas
>>
>>
>>
>>
>>> Best,
>>> James.
>>>
>>> On 14 April 2010 17:01, Igor Vaynberg<igor.vaynb...@gmail.com>  wrote:
>>>
>>>> you are going to have one factory method for each constructor, its
>>>> going to be a pita to maintain. not something we will want in core.
>>>>
>>>> -igor
>>>>
>>>> On Wed, Apr 14, 2010 at 8:51 AM, James Perry
>>>> <james.austin.pe...@gmail.com>  wrote:
>>>>
>>>>> I am looking to migrate from Wicket 1.3 and Wicket 1.4 and I really
>>>>> like the type-safe goodies but I do not like its verbosity. I was
>>>>> thinking of writing a patch that provides factories to improve the
>>>>> brevity by type inference of the generic invariant.
>>>>>
>>>>> This is an example of my idea:
>>>>>
>>>>> Model<MySuperLongNameForASimpleFooObject>  model = Model.newModel();
>>>>>
>>>>> public static<T>  Model<T>  newModel() {
>>>>>    return new Model<T>();
>>>>> }
>>>>>
>>>>> Feedback welcomed. :-)
>>>>>
>>>>> --
>>>>> Best,
>>>>> James.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> --
>> -------------------------------------------------------------------
>>  Thomas Kappler                        thomas.kapp...@isb-sib.ch
>>  Swiss Institute of Bioinformatics         Tel: +41 22 379 51 89
>>  CMU, rue Michel Servet 1
>>  1211 Geneve 4
>>  Switzerland                              http://www.uniprot.org
>>
>> -------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


      

Reply via email to