You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Broekelmann, Mathias" <MB...@PSI.DE> on 2005/04/04 14:30:24 UTC

Better object.toString() instead of cast (String)object

Hi,

To get a string value from a valuebinding the getter methods of the
components always cast the object value to string (ex:
HtmlOutputLink.getTitle()).

A better way would be to test if the object is null and if it is not
null call object.toString() and return that value.

That would make it possible to use java.lang.CharSequence or any other
object instances to use as a value for the properties.

Mathias


Re: Better object.toString() instead of cast (String)object

Posted by Heath Borders <he...@gmail.com>.
This might be more of a shortcoming on the part of the spec rather than 
MyFaces. String is used all over the spec, so I think that's all we really 
need to support. I understand that CharSequence is more generic, but it 
seems like more of a spec issue.

On Apr 4, 2005 7:30 AM, Broekelmann, Mathias <MB...@psi.de> wrote: 
> 
> Hi,
> 
> To get a string value from a valuebinding the getter methods of the
> components always cast the object value to string (ex:
> HtmlOutputLink.getTitle()).
> 
> A better way would be to test if the object is null and if it is not
> null call object.toString() and return that value.
> 
> That would make it possible to use java.lang.CharSequence or any other
> object instances to use as a value for the properties.
> 
> Mathias
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org