You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Ernesto Reinaldo Barreiro <re...@gmail.com> on 2010/09/15 15:22:30 UTC

CompoundPropertyModel constructor

My apologies if this has been discussed before...

Right now the constructor of CompoundPropertyModel is as follows:

        /**
	 * Constructor
	 *
	 * @param object
	 *            The model object, which may or may not implement IModel
	 */
	public CompoundPropertyModel(final Object object)
	{
		target = object;
	}

which allows users to do something like:

new CompoundPropertyModel<XXX>(new YYY());

without generating a compiler error. Would it make sense to replace
this constructor by two constructors...

        /**
	 * Constructor
	 *
	 * @param object
	 *            The model object
	 */
	public CompoundPropertyModel(final T object)
	{
		target = object;
	}

	/**
	 * Constructor
	 *
	 * @param object
	 *            an instance of IModel<T>
	 */
	public CompoundPropertyModel(final IModel<T> object)
	{
		target = object;
	}

at least on 1.5?

Regards,

Ernesto

Re: CompoundPropertyModel constructor

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
It seems Peter Earl already "fixed" this. Missed my opportunity to
roll  out a (small) patch :-(

Cheers,

Ernesto

On Thu, Sep 16, 2010 at 8:21 AM, Ernesto Reinaldo Barreiro
<re...@gmail.com> wrote:
> Hi Martin,
>
> I fail to see how would this be a problem?
>
> Ernesto
>
>
> On Wed, Sep 15, 2010 at 8:39 PM, Martin Grigorov <mg...@apache.org> wrote:
>> Looking at the code I see the problem is
>> org.apache.wicket.model.CompoundPropertyModel.setChainedModel(IModel<?>)
>>
>> On Wed, Sep 15, 2010 at 4:27 PM, Martin Grigorov <mg...@apache.org>wrote:
>>
>>> Don't hesitate to provide patches ;-)
>>>
>>>
>>> On Wed, Sep 15, 2010 at 4:06 PM, Ernesto Reinaldo Barreiro <
>>> reiern70@gmail.com> wrote:
>>>
>>>> Shall I provide a patch for 1.5 and attach it to a JIRA ticket?
>>>> Probably this change cannot be applied to 1.4.x (as it might break
>>>> existing apps)
>>>>
>>>> Ernesto
>>>>
>>>> On Wed, Sep 15, 2010 at 4:02 PM, Martin Grigorov <mg...@apache.org>
>>>> wrote:
>>>> > Looks good to me.
>>>> > I've never seen that this ctor looks this way and I don't remember
>>>> > discussion related to that.
>>>> >
>>>> > On Wed, Sep 15, 2010 at 3:22 PM, Ernesto Reinaldo Barreiro <
>>>> > reiern70@gmail.com> wrote:
>>>> >
>>>> >> My apologies if this has been discussed before...
>>>> >>
>>>> >> Right now the constructor of CompoundPropertyModel is as follows:
>>>> >>
>>>> >>        /**
>>>> >>         * Constructor
>>>> >>         *
>>>> >>         * @param object
>>>> >>         *            The model object, which may or may not implement
>>>> >> IModel
>>>> >>         */
>>>> >>        public CompoundPropertyModel(final Object object)
>>>> >>        {
>>>> >>                target = object;
>>>> >>        }
>>>> >>
>>>> >> which allows users to do something like:
>>>> >>
>>>> >> new CompoundPropertyModel<XXX>(new YYY());
>>>> >>
>>>> >> without generating a compiler error. Would it make sense to replace
>>>> >> this constructor by two constructors...
>>>> >>
>>>> >>        /**
>>>> >>         * Constructor
>>>> >>         *
>>>> >>         * @param object
>>>> >>         *            The model object
>>>> >>         */
>>>> >>        public CompoundPropertyModel(final T object)
>>>> >>        {
>>>> >>                target = object;
>>>> >>        }
>>>> >>
>>>> >>        /**
>>>> >>         * Constructor
>>>> >>         *
>>>> >>         * @param object
>>>> >>         *            an instance of IModel<T>
>>>> >>         */
>>>> >>        public CompoundPropertyModel(final IModel<T> object)
>>>> >>        {
>>>> >>                target = object;
>>>> >>        }
>>>> >>
>>>> >> at least on 1.5?
>>>> >>
>>>> >> Regards,
>>>> >>
>>>> >> Ernesto
>>>> >>
>>>> >
>>>>
>>>
>>>
>>
>

Re: CompoundPropertyModel constructor

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi Martin,

I fail to see how would this be a problem?

Ernesto


On Wed, Sep 15, 2010 at 8:39 PM, Martin Grigorov <mg...@apache.org> wrote:
> Looking at the code I see the problem is
> org.apache.wicket.model.CompoundPropertyModel.setChainedModel(IModel<?>)
>
> On Wed, Sep 15, 2010 at 4:27 PM, Martin Grigorov <mg...@apache.org>wrote:
>
>> Don't hesitate to provide patches ;-)
>>
>>
>> On Wed, Sep 15, 2010 at 4:06 PM, Ernesto Reinaldo Barreiro <
>> reiern70@gmail.com> wrote:
>>
>>> Shall I provide a patch for 1.5 and attach it to a JIRA ticket?
>>> Probably this change cannot be applied to 1.4.x (as it might break
>>> existing apps)
>>>
>>> Ernesto
>>>
>>> On Wed, Sep 15, 2010 at 4:02 PM, Martin Grigorov <mg...@apache.org>
>>> wrote:
>>> > Looks good to me.
>>> > I've never seen that this ctor looks this way and I don't remember
>>> > discussion related to that.
>>> >
>>> > On Wed, Sep 15, 2010 at 3:22 PM, Ernesto Reinaldo Barreiro <
>>> > reiern70@gmail.com> wrote:
>>> >
>>> >> My apologies if this has been discussed before...
>>> >>
>>> >> Right now the constructor of CompoundPropertyModel is as follows:
>>> >>
>>> >>        /**
>>> >>         * Constructor
>>> >>         *
>>> >>         * @param object
>>> >>         *            The model object, which may or may not implement
>>> >> IModel
>>> >>         */
>>> >>        public CompoundPropertyModel(final Object object)
>>> >>        {
>>> >>                target = object;
>>> >>        }
>>> >>
>>> >> which allows users to do something like:
>>> >>
>>> >> new CompoundPropertyModel<XXX>(new YYY());
>>> >>
>>> >> without generating a compiler error. Would it make sense to replace
>>> >> this constructor by two constructors...
>>> >>
>>> >>        /**
>>> >>         * Constructor
>>> >>         *
>>> >>         * @param object
>>> >>         *            The model object
>>> >>         */
>>> >>        public CompoundPropertyModel(final T object)
>>> >>        {
>>> >>                target = object;
>>> >>        }
>>> >>
>>> >>        /**
>>> >>         * Constructor
>>> >>         *
>>> >>         * @param object
>>> >>         *            an instance of IModel<T>
>>> >>         */
>>> >>        public CompoundPropertyModel(final IModel<T> object)
>>> >>        {
>>> >>                target = object;
>>> >>        }
>>> >>
>>> >> at least on 1.5?
>>> >>
>>> >> Regards,
>>> >>
>>> >> Ernesto
>>> >>
>>> >
>>>
>>
>>
>

Re: CompoundPropertyModel constructor

Posted by Martin Grigorov <mg...@apache.org>.
Looking at the code I see the problem is
org.apache.wicket.model.CompoundPropertyModel.setChainedModel(IModel<?>)

On Wed, Sep 15, 2010 at 4:27 PM, Martin Grigorov <mg...@apache.org>wrote:

> Don't hesitate to provide patches ;-)
>
>
> On Wed, Sep 15, 2010 at 4:06 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
>> Shall I provide a patch for 1.5 and attach it to a JIRA ticket?
>> Probably this change cannot be applied to 1.4.x (as it might break
>> existing apps)
>>
>> Ernesto
>>
>> On Wed, Sep 15, 2010 at 4:02 PM, Martin Grigorov <mg...@apache.org>
>> wrote:
>> > Looks good to me.
>> > I've never seen that this ctor looks this way and I don't remember
>> > discussion related to that.
>> >
>> > On Wed, Sep 15, 2010 at 3:22 PM, Ernesto Reinaldo Barreiro <
>> > reiern70@gmail.com> wrote:
>> >
>> >> My apologies if this has been discussed before...
>> >>
>> >> Right now the constructor of CompoundPropertyModel is as follows:
>> >>
>> >>        /**
>> >>         * Constructor
>> >>         *
>> >>         * @param object
>> >>         *            The model object, which may or may not implement
>> >> IModel
>> >>         */
>> >>        public CompoundPropertyModel(final Object object)
>> >>        {
>> >>                target = object;
>> >>        }
>> >>
>> >> which allows users to do something like:
>> >>
>> >> new CompoundPropertyModel<XXX>(new YYY());
>> >>
>> >> without generating a compiler error. Would it make sense to replace
>> >> this constructor by two constructors...
>> >>
>> >>        /**
>> >>         * Constructor
>> >>         *
>> >>         * @param object
>> >>         *            The model object
>> >>         */
>> >>        public CompoundPropertyModel(final T object)
>> >>        {
>> >>                target = object;
>> >>        }
>> >>
>> >>        /**
>> >>         * Constructor
>> >>         *
>> >>         * @param object
>> >>         *            an instance of IModel<T>
>> >>         */
>> >>        public CompoundPropertyModel(final IModel<T> object)
>> >>        {
>> >>                target = object;
>> >>        }
>> >>
>> >> at least on 1.5?
>> >>
>> >> Regards,
>> >>
>> >> Ernesto
>> >>
>> >
>>
>
>

Re: CompoundPropertyModel constructor

Posted by Martin Grigorov <mg...@apache.org>.
Don't hesitate to provide patches ;-)

On Wed, Sep 15, 2010 at 4:06 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Shall I provide a patch for 1.5 and attach it to a JIRA ticket?
> Probably this change cannot be applied to 1.4.x (as it might break
> existing apps)
>
> Ernesto
>
> On Wed, Sep 15, 2010 at 4:02 PM, Martin Grigorov <mg...@apache.org>
> wrote:
> > Looks good to me.
> > I've never seen that this ctor looks this way and I don't remember
> > discussion related to that.
> >
> > On Wed, Sep 15, 2010 at 3:22 PM, Ernesto Reinaldo Barreiro <
> > reiern70@gmail.com> wrote:
> >
> >> My apologies if this has been discussed before...
> >>
> >> Right now the constructor of CompoundPropertyModel is as follows:
> >>
> >>        /**
> >>         * Constructor
> >>         *
> >>         * @param object
> >>         *            The model object, which may or may not implement
> >> IModel
> >>         */
> >>        public CompoundPropertyModel(final Object object)
> >>        {
> >>                target = object;
> >>        }
> >>
> >> which allows users to do something like:
> >>
> >> new CompoundPropertyModel<XXX>(new YYY());
> >>
> >> without generating a compiler error. Would it make sense to replace
> >> this constructor by two constructors...
> >>
> >>        /**
> >>         * Constructor
> >>         *
> >>         * @param object
> >>         *            The model object
> >>         */
> >>        public CompoundPropertyModel(final T object)
> >>        {
> >>                target = object;
> >>        }
> >>
> >>        /**
> >>         * Constructor
> >>         *
> >>         * @param object
> >>         *            an instance of IModel<T>
> >>         */
> >>        public CompoundPropertyModel(final IModel<T> object)
> >>        {
> >>                target = object;
> >>        }
> >>
> >> at least on 1.5?
> >>
> >> Regards,
> >>
> >> Ernesto
> >>
> >
>

Re: CompoundPropertyModel constructor

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Shall I provide a patch for 1.5 and attach it to a JIRA ticket?
Probably this change cannot be applied to 1.4.x (as it might break
existing apps)

Ernesto

On Wed, Sep 15, 2010 at 4:02 PM, Martin Grigorov <mg...@apache.org> wrote:
> Looks good to me.
> I've never seen that this ctor looks this way and I don't remember
> discussion related to that.
>
> On Wed, Sep 15, 2010 at 3:22 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
>> My apologies if this has been discussed before...
>>
>> Right now the constructor of CompoundPropertyModel is as follows:
>>
>>        /**
>>         * Constructor
>>         *
>>         * @param object
>>         *            The model object, which may or may not implement
>> IModel
>>         */
>>        public CompoundPropertyModel(final Object object)
>>        {
>>                target = object;
>>        }
>>
>> which allows users to do something like:
>>
>> new CompoundPropertyModel<XXX>(new YYY());
>>
>> without generating a compiler error. Would it make sense to replace
>> this constructor by two constructors...
>>
>>        /**
>>         * Constructor
>>         *
>>         * @param object
>>         *            The model object
>>         */
>>        public CompoundPropertyModel(final T object)
>>        {
>>                target = object;
>>        }
>>
>>        /**
>>         * Constructor
>>         *
>>         * @param object
>>         *            an instance of IModel<T>
>>         */
>>        public CompoundPropertyModel(final IModel<T> object)
>>        {
>>                target = object;
>>        }
>>
>> at least on 1.5?
>>
>> Regards,
>>
>> Ernesto
>>
>

Re: CompoundPropertyModel constructor

Posted by Major Péter <ma...@sch.bme.hu>.
Maybe IModel<? extends T> is better, or?

Regards,
Peter

2010-09-15 16:02 keltezéssel, Martin Grigorov írta:
> Looks good to me.
> I've never seen that this ctor looks this way and I don't remember
> discussion related to that.
> 
> On Wed, Sep 15, 2010 at 3:22 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
> 
>> My apologies if this has been discussed before...
>>
>> Right now the constructor of CompoundPropertyModel is as follows:
>>
>>        /**
>>         * Constructor
>>         *
>>         * @param object
>>         *            The model object, which may or may not implement
>> IModel
>>         */
>>        public CompoundPropertyModel(final Object object)
>>        {
>>                target = object;
>>        }
>>
>> which allows users to do something like:
>>
>> new CompoundPropertyModel<XXX>(new YYY());
>>
>> without generating a compiler error. Would it make sense to replace
>> this constructor by two constructors...
>>
>>        /**
>>         * Constructor
>>         *
>>         * @param object
>>         *            The model object
>>         */
>>        public CompoundPropertyModel(final T object)
>>        {
>>                target = object;
>>        }
>>
>>        /**
>>         * Constructor
>>         *
>>         * @param object
>>         *            an instance of IModel<T>
>>         */
>>        public CompoundPropertyModel(final IModel<T> object)
>>        {
>>                target = object;
>>        }
>>
>> at least on 1.5?
>>
>> Regards,
>>
>> Ernesto
>>
> 

Re: CompoundPropertyModel constructor

Posted by Martin Grigorov <mg...@apache.org>.
Looks good to me.
I've never seen that this ctor looks this way and I don't remember
discussion related to that.

On Wed, Sep 15, 2010 at 3:22 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> My apologies if this has been discussed before...
>
> Right now the constructor of CompoundPropertyModel is as follows:
>
>        /**
>         * Constructor
>         *
>         * @param object
>         *            The model object, which may or may not implement
> IModel
>         */
>        public CompoundPropertyModel(final Object object)
>        {
>                target = object;
>        }
>
> which allows users to do something like:
>
> new CompoundPropertyModel<XXX>(new YYY());
>
> without generating a compiler error. Would it make sense to replace
> this constructor by two constructors...
>
>        /**
>         * Constructor
>         *
>         * @param object
>         *            The model object
>         */
>        public CompoundPropertyModel(final T object)
>        {
>                target = object;
>        }
>
>        /**
>         * Constructor
>         *
>         * @param object
>         *            an instance of IModel<T>
>         */
>        public CompoundPropertyModel(final IModel<T> object)
>        {
>                target = object;
>        }
>
> at least on 1.5?
>
> Regards,
>
> Ernesto
>