You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Matthias Wessendorf <ma...@apache.org> on 2007/05/18 05:02:48 UTC
Fwd: [API] Converter(s).getAsString()
FYI
---------- Forwarded message ----------
From: Matthias Wessendorf <ma...@apache.org>
Date: May 17, 2007 8:01 PM
Subject: [API] Converter(s).getAsString()
To: dev@javaserverfaces.dev.java.net
Hi,
I pass in a Number (Integer) to a converter, let's say DoubleConverter
and I get a classcastexception.
the RI does:
try {
return (Float.toString(((Float) value).floatValue()));
}
MyFaces does:
try
{
return Double.toString(((Number)value).doubleValue());
}
Shouldn't the RI use Number as well ?
-Matthias
http://fisheye5.cenqua.com/browse/~raw,r=1.21/javaserverfaces-sources/jsf-api/src/javax/faces/convert/DoubleConverter.java
--
Matthias Wessendorf
http://tinyurl.com/fmywh
further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com
--
Matthias Wessendorf
http://tinyurl.com/fmywh
further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com
Re: [API] Converter(s).getAsString()
Posted by Adam Winer <aw...@gmail.com>.
There's never a reason to cast anything to
a specific subtype of Number if you're just
going to extract a primitive from it. Casting
to Number (the MyFaces way) is better.
-- Adam
On 5/17/07, Matthias Wessendorf <ma...@apache.org> wrote:
> FYI
>
> ---------- Forwarded message ----------
> From: Matthias Wessendorf <ma...@apache.org>
> Date: May 17, 2007 8:01 PM
> Subject: [API] Converter(s).getAsString()
> To: dev@javaserverfaces.dev.java.net
>
>
> Hi,
>
> I pass in a Number (Integer) to a converter, let's say DoubleConverter
> and I get a classcastexception.
>
> the RI does:
> try {
> return (Float.toString(((Float) value).floatValue()));
> }
>
> MyFaces does:
> try
> {
> return Double.toString(((Number)value).doubleValue());
> }
>
> Shouldn't the RI use Number as well ?
>
> -Matthias
>
> http://fisheye5.cenqua.com/browse/~raw,r=1.21/javaserverfaces-sources/jsf-api/src/javax/faces/convert/DoubleConverter.java
>
> --
> Matthias Wessendorf
> http://tinyurl.com/fmywh
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>
>
> --
> Matthias Wessendorf
> http://tinyurl.com/fmywh
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>