[ 
https://issues.apache.org/jira/browse/TAPESTRY-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611658#action_12611658
 ] 

Robert Zeigler commented on TAPESTRY-2491:
------------------------------------------

After thinking about this some more, it occurred to me that the right solution 
is probably to nix PrimaryKeyEncoder entirely. 
Instead, Loop and grid, like many other components, should be using 
ValueEncoders to do the job.  Consider the implementation of the hibernate 
value encoders: they are effectively PrimaryKeyEncoders.  The main difference 
between the two interfaces is that PrimaryKeyEncoder is slightly more lenient: 
the "client" value merely has to be serializable, whereas the ValueEncoder must 
encode to a string.  But the key is ultimately going to be stored on the client 
as a string, so there seems to be no reason why you wouldn't just use 
ValueEncoder.  This would get rid of one redundant interface 
(PrimaryKeyEncoder) /and/ allow Loop, Grid, etc. to tie into the very nice set 
of services available for looking up ValueEncoders, so that you can contribute 
your value encoder(s), and have stuff "just work".

> Components which use PrimaryKeyEncoder should be able to look them up from a 
> service
> ------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2491
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2491
>             Project: Tapestry
>          Issue Type: Improvement
>    Affects Versions: 5.0.14
>         Environment: any
>            Reporter: Robert Zeigler
>            Priority: Minor
>
> While working on an application, I noticed that my objects were being 
> serialized "weird" into a form by the loop component.  I realized that I 
> hadn't provided the primary key encoder, and once I did things worked as 
> expected.  That got me to thinking that it would be nice if the Loop 
> component, and other components that rely on PrimaryKeyEncoders, could check 
> to see if there is an encoder available for the value-type, if none is 
> explicitly bound by the user.  That way, module-authors could provide 
> PrimaryKeyEncoders that makes things work "like magic". 
> For example, tapestry-hibernate could contribute PrimaryKeyEncoders for each 
> entity type so that the objects are automatically, and properly, encoded into 
> forms.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to