You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2012/01/31 03:27:38 UTC

subclass overrides parameter value

Hi all,

I have a component with:

     @Parameter(defaultPrefix = BindingConstants.LITERAL, value = "30")
     private int maxResults;

and I also have a subclass component for which I would like to change 
the default the value for 'maxResults' to 10.

When either component (super or sub) is used, i would like the parameter 
to be optional.

How is this possible?

Thanks, Paul.

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


Re: subclass overrides parameter value

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 31 Jan 2012 00:27:38 -0200, Paul Stanton <pa...@mapshed.com.au>  
wrote:

> Hi all,

Hi!

>
> I have a component with:
>
>      @Parameter(defaultPrefix = BindingConstants.LITERAL, value = "30")
>      private int maxResults;
>
> and I also have a subclass component for which I would like to change  
> the default the value for 'maxResults' to 10.
>
> When either component (super or sub) is used, i would like the parameter  
> to be optional.

Have you tried to provide the default value with a defaultMaxResults()  
method instead of the value attribute of @Parameter? This way, you can  
change the default value using ordinary method override.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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