dev@javaserverfaces.java.net

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

From: Mike Kienenberger <mkienenb_at_gmail.com>
Date: Tue, 9 Aug 2005 13:01:04 -0400

Performance seems like a pretty weak argument.

If that's the only issue, then one of many possible solutions is to
return some default placeholder converters for String and Object that
just pass-through the values when no converter is found.

-Mike

On 8/9/05, Adam Winer <adam.winer_at_oracle.com> wrote:
> 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
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>
>