dev@javaserverfaces.java.net

Re: JSF-RI disallows custom String (and Object) converters?

From: Adam Winer <adam.winer_at_oracle.com>
Date: Tue, 09 Aug 2005 09:52:48 -0700

Mike,

You can create a custom converter and manually attach
it to components, but we can't really allow custom
String and Object converters.

For starters, Application.createConverter(Class) throws
an exception if nothing is registered - so we'd have
to wrap UIInput.getConverterWithType() with
"try/catch (FacesException e)" - which would be
brutal for performance, since a common scenario would
result in a thrown exception.

-- Adam



Mike Kienenberger wrote:
> I notice that the JSF-RI disallows custom String (and Object) converters.
>
> Inside the private method UIInput.getConverterWithType(FacesContext context),
>
> // if converterType is null, String, or Object, assume no
> conversion is needed
>
> I don't see anything mentioned in the spec or javadocs that requires
> this restriction.
>
> Does this limitation have to followed in all JSF-compliant
> implementations? (I originally brought this up on the MyFaces dev
> list, but was told that Myfaces had to follow the JSF-RI behavior for
> compatibility.)
>
> My use case is that I would like to create a java.lang.String
> converter that automatically converts all empty strings to null.
>
> Thanks!
>
> -Mike Kienenberger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>