You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Fabio Cechinel Veronez <fa...@gmail.com> on 2011/07/13 16:46:29 UTC

PageParameters, IIndexedParameters, INamedParameters hierarchy on wicket 1.5

Hello all,

I was in doubt whether this message should be sent to user or dev list
so following http://wicket.apache.org/help/email.html page
recommendation I'm sending it to user list.

Well, I was trying wicket-1.5-RC5.1 and I notice that PageParameters
class implements two new interfaces IIndexedParameters and
INamedParameters. What called my attention was that methods defined at
those interfaces are defined to return the implementation type
(PageParameters). Ex:

public interface INamedParameters {
    //...
    PageParameters remove(final String name);
    //...
}

public interface IIndexedParameters {
    //...
    PageParameters set(final int index, final Object object);
    //...
}

What is the point of it? This way if one want to implement this
interface he won't be able to return his implementation instance.

Wouldn't be better to have the interface methods returning the
interface types and use covariant return type on implementation type?
Like:

public interface INamedParameters {
    //...
    INamedParameters remove(final String name);
    //...
}

public interface IIndexedParameters {
    //...
    IIndexedParameters set(final int index, final Object object);
    //...
}

public class PageParameters implements Serializable,
IIndexedParameters, INamedParameters {

    //...
    PageParameters set(final int index, final Object object) {
        //...
        return this;
    }
    //...

    //...
    PageParameters remove(final String name) {
        //...
        return this;
    }
    //...
}

Thanks in advance.

-- 
Fabio Cechinel Veronez

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


Re: PageParameters, IIndexedParameters, INamedParameters hierarchy on wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
Fixed with https://issues.apache.org/jira/browse/WICKET-3896

On Wed, Jul 13, 2011 at 5:48 PM, Martin Grigorov <mg...@apache.org> wrote:
> Good catch!
> Please create a ticket.
>
> On Wed, Jul 13, 2011 at 5:46 PM, Fabio Cechinel Veronez
> <fa...@gmail.com> wrote:
>> Hello all,
>>
>> I was in doubt whether this message should be sent to user or dev list
>> so following http://wicket.apache.org/help/email.html page
>> recommendation I'm sending it to user list.
>>
>> Well, I was trying wicket-1.5-RC5.1 and I notice that PageParameters
>> class implements two new interfaces IIndexedParameters and
>> INamedParameters. What called my attention was that methods defined at
>> those interfaces are defined to return the implementation type
>> (PageParameters). Ex:
>>
>> public interface INamedParameters {
>>    //...
>>    PageParameters remove(final String name);
>>    //...
>> }
>>
>> public interface IIndexedParameters {
>>    //...
>>    PageParameters set(final int index, final Object object);
>>    //...
>> }
>>
>> What is the point of it? This way if one want to implement this
>> interface he won't be able to return his implementation instance.
>>
>> Wouldn't be better to have the interface methods returning the
>> interface types and use covariant return type on implementation type?
>> Like:
>>
>> public interface INamedParameters {
>>    //...
>>    INamedParameters remove(final String name);
>>    //...
>> }
>>
>> public interface IIndexedParameters {
>>    //...
>>    IIndexedParameters set(final int index, final Object object);
>>    //...
>> }
>>
>> public class PageParameters implements Serializable,
>> IIndexedParameters, INamedParameters {
>>
>>    //...
>>    PageParameters set(final int index, final Object object) {
>>        //...
>>        return this;
>>    }
>>    //...
>>
>>    //...
>>    PageParameters remove(final String name) {
>>        //...
>>        return this;
>>    }
>>    //...
>> }
>>
>> Thanks in advance.
>>
>> --
>> Fabio Cechinel Veronez
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: PageParameters, IIndexedParameters, INamedParameters hierarchy on wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
Good catch!
Please create a ticket.

On Wed, Jul 13, 2011 at 5:46 PM, Fabio Cechinel Veronez
<fa...@gmail.com> wrote:
> Hello all,
>
> I was in doubt whether this message should be sent to user or dev list
> so following http://wicket.apache.org/help/email.html page
> recommendation I'm sending it to user list.
>
> Well, I was trying wicket-1.5-RC5.1 and I notice that PageParameters
> class implements two new interfaces IIndexedParameters and
> INamedParameters. What called my attention was that methods defined at
> those interfaces are defined to return the implementation type
> (PageParameters). Ex:
>
> public interface INamedParameters {
>    //...
>    PageParameters remove(final String name);
>    //...
> }
>
> public interface IIndexedParameters {
>    //...
>    PageParameters set(final int index, final Object object);
>    //...
> }
>
> What is the point of it? This way if one want to implement this
> interface he won't be able to return his implementation instance.
>
> Wouldn't be better to have the interface methods returning the
> interface types and use covariant return type on implementation type?
> Like:
>
> public interface INamedParameters {
>    //...
>    INamedParameters remove(final String name);
>    //...
> }
>
> public interface IIndexedParameters {
>    //...
>    IIndexedParameters set(final int index, final Object object);
>    //...
> }
>
> public class PageParameters implements Serializable,
> IIndexedParameters, INamedParameters {
>
>    //...
>    PageParameters set(final int index, final Object object) {
>        //...
>        return this;
>    }
>    //...
>
>    //...
>    PageParameters remove(final String name) {
>        //...
>        return this;
>    }
>    //...
> }
>
> Thanks in advance.
>
> --
> Fabio Cechinel Veronez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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