You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ted Steen <te...@gmail.com> on 2007/02/06 18:29:04 UTC

T5: Type coercer question

Hi,

Im trying to contribute a type coercer from MyType to String (and vice versa),
but it seems like the Object to String is used instead. When the
ActionLink is rendered with a MyType in the context it renders to the
value toString() returns, not the value my MyType->String coercer
gives.

I have tried to add @Order("before:*.*") to the contribution, but to no avail...
any suggestions?

-- 
/ted

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


Re: T5: Type coercer question

Posted by Howard Lewis Ship <hl...@gmail.com>.
To be honest, I'm trying to avoid having the framework do to much
here. Given the tools that are available, which is to say
"injectable", the need for the framework to do stuff like T4's
DataSqueezer is greatly reduced (in fact, had I had HiveMind and a few
good ideas in T2 DataSqueezer would never have existed).

So my initial thought was that the context would be entity.id, and
your event handler method would include the code to convert the id
back to the entity. Down side: that much more code. Up side: control
over when it happens and how to recover from any errors (such as an
entity getting deleted between requests).

On 2/6/07, Ted Steen <te...@gmail.com> wrote:
> What I am trying to do is a way to pass database entity objects (or
> really my DTOs) to my listener methods.
> So the type coercer simply should coerce the entity to its unique key
> and use that as the client side representation of the entity.
>
> There are surely greater plans for these type of things, but I still
> would like to know if this is the intended use of a TC. Or should I
> maybe rethink the way to pass entity object between the client and
> server?
>
>
>
>
> 2007/2/6, Howard Lewis Ship <hl...@gmail.com>:
> > Geez ... that toString() is burried pretty deep!  Inside
> > LinkFactoryImpl, inside ComponentInvocation.
> >
> > On 2/6/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > > I think ActionLink simply invokes toString().
> > >
> > > I don't see why we couldn't use the TypeCoercer for this purpose.
> > >
> > > In most cases, the coercer will simply invoke toString().
> > >
> > > The TypeCoercer is used on the flip side, mapping string query
> > > parameter values to typed event handler method parameters, so I can't
> > > see why not using it for your situation would matter.
> > >
> > > On 2/6/07, Ted Steen <te...@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > Im trying to contribute a type coercer from MyType to String (and vice versa),
> > > > but it seems like the Object to String is used instead. When the
> > > > ActionLink is rendered with a MyType in the context it renders to the
> > > > value toString() returns, not the value my MyType->String coercer
> > > > gives.
> > > >
> > > > I have tried to add @Order("before:*.*") to the contribution, but to no avail...
> > > > any suggestions?
> > > >
> > > > --
> > > > /ted
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Howard M. Lewis Ship
> > > TWD Consulting, Inc.
> > > Independent J2EE / Open-Source Java Consultant
> > > Creator and PMC Chair, Apache Tapestry
> > > Creator, Apache HiveMind
> > >
> > > Professional Tapestry training, mentoring, support
> > > and project work.  http://howardlewisship.com
> > >
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> /ted
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: T5: Type coercer question

Posted by Ted Steen <te...@gmail.com>.
What I am trying to do is a way to pass database entity objects (or
really my DTOs) to my listener methods.
So the type coercer simply should coerce the entity to its unique key
and use that as the client side representation of the entity.

There are surely greater plans for these type of things, but I still
would like to know if this is the intended use of a TC. Or should I
maybe rethink the way to pass entity object between the client and
server?




2007/2/6, Howard Lewis Ship <hl...@gmail.com>:
> Geez ... that toString() is burried pretty deep!  Inside
> LinkFactoryImpl, inside ComponentInvocation.
>
> On 2/6/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > I think ActionLink simply invokes toString().
> >
> > I don't see why we couldn't use the TypeCoercer for this purpose.
> >
> > In most cases, the coercer will simply invoke toString().
> >
> > The TypeCoercer is used on the flip side, mapping string query
> > parameter values to typed event handler method parameters, so I can't
> > see why not using it for your situation would matter.
> >
> > On 2/6/07, Ted Steen <te...@gmail.com> wrote:
> > > Hi,
> > >
> > > Im trying to contribute a type coercer from MyType to String (and vice versa),
> > > but it seems like the Object to String is used instead. When the
> > > ActionLink is rendered with a MyType in the context it renders to the
> > > value toString() returns, not the value my MyType->String coercer
> > > gives.
> > >
> > > I have tried to add @Order("before:*.*") to the contribution, but to no avail...
> > > any suggestions?
> > >
> > > --
> > > /ted
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
/ted

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


Re: T5: Type coercer question

Posted by Howard Lewis Ship <hl...@gmail.com>.
Geez ... that toString() is burried pretty deep!  Inside
LinkFactoryImpl, inside ComponentInvocation.

On 2/6/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> I think ActionLink simply invokes toString().
>
> I don't see why we couldn't use the TypeCoercer for this purpose.
>
> In most cases, the coercer will simply invoke toString().
>
> The TypeCoercer is used on the flip side, mapping string query
> parameter values to typed event handler method parameters, so I can't
> see why not using it for your situation would matter.
>
> On 2/6/07, Ted Steen <te...@gmail.com> wrote:
> > Hi,
> >
> > Im trying to contribute a type coercer from MyType to String (and vice versa),
> > but it seems like the Object to String is used instead. When the
> > ActionLink is rendered with a MyType in the context it renders to the
> > value toString() returns, not the value my MyType->String coercer
> > gives.
> >
> > I have tried to add @Order("before:*.*") to the contribution, but to no avail...
> > any suggestions?
> >
> > --
> > /ted
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: T5: Type coercer question

Posted by Howard Lewis Ship <hl...@gmail.com>.
I think ActionLink simply invokes toString().

I don't see why we couldn't use the TypeCoercer for this purpose.

In most cases, the coercer will simply invoke toString().

The TypeCoercer is used on the flip side, mapping string query
parameter values to typed event handler method parameters, so I can't
see why not using it for your situation would matter.

On 2/6/07, Ted Steen <te...@gmail.com> wrote:
> Hi,
>
> Im trying to contribute a type coercer from MyType to String (and vice versa),
> but it seems like the Object to String is used instead. When the
> ActionLink is rendered with a MyType in the context it renders to the
> value toString() returns, not the value my MyType->String coercer
> gives.
>
> I have tried to add @Order("before:*.*") to the contribution, but to no avail...
> any suggestions?
>
> --
> /ted
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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