Good catch!
Please create a ticket.

On Wed, Jul 13, 2011 at 5:46 PM, Fabio Cechinel Veronez
<[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to