You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vjeran Marcinko <vj...@email.t-com.hr> on 2007/11/16 17:39:07 UTC

[T5.0.6] Is coercion MANDATORY for custom parameter classes?

Hello.

Still getting acquainted with T5, and I created my first component called 
ImageMessage that accepts my custom ImageMessageModel parameter:

public class ImageMessage {

    @Parameter(required = true)
    private ImageMessageModel model;
....
}

And when I bound my ImageMessageModel instance to that component's 
parameter, I got following exception note:
Could not find a coercion from type 
com.t5test.tapestry.base.ImageMessageModel to type 
com.t5test.tapestry.base.ImageMessageModel

Of course, I don't have coercion type registered for my custom class, but I 
don't need it because I'm NOT trying to bind different classes, just to pass 
instance of exactly the required parameter class. I hope the exception above 
doesn't mean that I have to register new coercion type for each custom class 
tha tI use as parameter inside my components? I looked at the docs abour 
parameter binding, and I didn't find that rule either.
So I am confused what the above exception means?

Regards,
Vjeran


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


Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes?

Posted by Vjeran Marcinko <vj...@email.t-com.hr>.
Yes, I kept my parameter class inside same package as component, since it is 
only sensible place to keep it.
It feels a bit stupid to have ImageMessage and ImageMessageModel in separate 
packages. So, its classloader issue then because of mandatory type of 
packaging.

Hope this will change sometime in a future, because it really disturbs 
proper packaging.

Since I have just criticism in my last mails, I want to say there are bunch 
of things which are SOOOO better then previous versions of Tapestry.

-V.jeran

----- Original Message ----- 
From: "Davor Hrg" <hr...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Friday, November 16, 2007 8:35 PM
Subject: Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes?


you must move any class that is not page or componenta from
base, components, pages packages

they get enhanced and those exceptions occur
http://wiki.apache.org/tapestry/Tapestry5HowToNotMakeCustomComponent

Davor Hrg


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


Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes?

Posted by Davor Hrg <hr...@gmail.com>.
you must move any class that is not page or componenta from
base, components, pages packages

they get enhanced and those exceptions occur
http://wiki.apache.org/tapestry/Tapestry5HowToNotMakeCustomComponent

Davor Hrg

On Nov 16, 2007 5:57 PM, César Lesc <ce...@gmail.com> wrote:

> You don't have to create a coercion for you custom class, how do you
> declare the binding in the template?.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes? [BUG?]

Posted by César Lesc <ce...@gmail.com>.
That's weird, i do the same but in a component template, and have no problems

I have a MenuItem that will render for certains users but not for others.
then my layout template define the menuItems as follow

...
<li t:type="MenuItem" user="user">....
...

the MenuItem component define the user parameter as
    @Parameter(required = true)
    private UserSession user;

and the layout component class define the getter as

    public UserSession getUser() {
        return userSession;
    }

userSession is a ASO and is instantiate in the log in process but i
don't think that matters.


Cesar.

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


Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes? [BUG?]

Posted by Vjeran Marcinko <vj...@email.t-com.hr>.
----- Original Message ----- 
From: "César Lesc" <ce...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Friday, November 16, 2007 5:57 PM
Subject: Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes?


> You don't have to create a coercion for you custom class, how do you
> declare the binding in the template?.

Just normally :

Start.tml :

<t:imagemessage t:model="imageMessageModel"/>

And of course, Start.java contains :

public ImageMessageModel getImageMessageModel() {
    return new ImageMessageModel(Type.ERROR, "some error");
}

Can this be a bug due to some classloading issue ?

Regards,
Vjeran


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


Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes?

Posted by César Lesc <ce...@gmail.com>.
You don't have to create a coercion for you custom class, how do you
declare the binding in the template?.

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