You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ville Virtanen <vi...@cerion.fi> on 2008/12/01 10:03:36 UTC

Re: T5: @Propery can not be an Interface? No default coercion?

You can have interface parameters, but the problem here is that you define a
parameter of type PageDelegate, and try to assign a default value of string
"false" to that parameter. Perhaps you meant @Property(required="false") ?

 - Ville



Maximilian Weißböck wrote:
> 
> I have a component that has a delegate as parameter binding like this:
> 
>  
> 
>    @Parameter("false")
> 
>    @Property
> 
>    private PageDelegate pageDelegate;
> 
>  
> 
> Inside the page I'm testing if the delegate is set (only then an
> ActionLink will be shown)
> 
>  
> 
>    <t:if test="pageDelegate">
> 
>  
> 
>  
> 
> PageDelegate is an Interface, and I'm getting this error on startup:
> 
>  
> 
> [ERROR] ipeople.Index Render queue error in
> BeginRender[ipeople/Index:iphonelistlayout.if_0]: Failure reading
> parameter 'test' of component ipeople/Index:iphonelistlayout.if_0: Failure
> reading parameter 'pageDelegate' of component
> ipeople/Index:iphonelistlayout: Could not find a coercion from type
> java.lang.Boolean to type at.sphinx.sxfinder.util.PageDelegate.  Available
> coercions: Double --> Float, Float --> Double, Long --> Boolean, Long -->
> Byte, Long --> Double, Long --> Integer, Long --> Short, Number --> Long,
> Object --> Object[], Object --> String,  ... [deleted]
> 
>  
> 
> Everything works fine if I change pageDelegate to type Object, as there is
> a default coercion for Object.
> 
> Now what I would like is the exact same behaviour for an Interface as it
> is for Object (test returns true if not null, false if null)
> 
>  
> 
> Is there e generic way to do this, or even better could that be standard
> behaviour in T5?
> 
> Anything that is against this possible standard behaviour?
> 
>  
> 
>  
> 
> And a second question:
> 
>  
> 
> What I'm doing with this PageDelegate is to give the Component access to
> the Page it is contained in.
> 
> Is there a better/standard way to do this?
> 
>  
> 
> Thanks, Max
> 
>  
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-%40Propery-can-not-be-an-Interface--No-default-coercion--tp20700914p20768313.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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