You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by Bob Schellink <sa...@gmail.com> on 2010/11/09 08:47:38 UTC

Generics question

Hope someone here knows here has an answer. :)

LinkDecorator has the following constructor:

  public LinkDecorator(Table table, List<AbstractControl> controls, String idProperty)

The following statement gives compiler error:

  List<AbstractLink> linksList = new ArrayList<AbstractLink>();
  LinkDecorator dec = new LinkDecorator(table, linksList, "id");

since the generic linksList is not compatible.

To make that a valid statement is the fix to change the constructort as follows?:

  public LinkDecorator(Table table, List<? extends AbstractControl> controls, String idProperty)

Kind regards

Bob

Re: Generics question

Posted by Malcolm Edgar <ma...@gmail.com>.
Hi Bob,

yes that is correct.

regards Malcolm Edgar

On Tue, Nov 9, 2010 at 6:47 PM, Bob Schellink <sa...@gmail.com> wrote:

> Hope someone here knows here has an answer. :)
>
> LinkDecorator has the following constructor:
>
>  public LinkDecorator(Table table, List<AbstractControl> controls, String
> idProperty)
>
> The following statement gives compiler error:
>
>  List<AbstractLink> linksList = new ArrayList<AbstractLink>();
>  LinkDecorator dec = new LinkDecorator(table, linksList, "id");
>
> since the generic linksList is not compatible.
>
> To make that a valid statement is the fix to change the constructort as
> follows?:
>
>  public LinkDecorator(Table table, List<? extends AbstractControl>
> controls, String idProperty)
>
> Kind regards
>
> Bob
>