myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@apache.org>
Subject Re: Using converters in non-JSF related code.
Date Fri, 02 Dec 2005 17:48:08 GMT
On 12/2/05, Mike Kienenberger <mkienenb@gmail.com> wrote:
>
> Well, the problem with JSF converters is that there's no way to do
> dependency injection on them.   So it'd be very difficult to assign a
> delegate to them.


Why not?  If the converter implementations have a public zero-args
constructor, you could use a DI framework to create them, and configure
their properties appropriately.

  I also don't see anything wrong with tight
> coupling in this case.   It's unlikely that you'll want to change the
> conversion rules dynamically by changing delegates instead of just
> changing the converter used.


The hard part for this use case is that the method parameters of the actual
conversion calls take a FacesContext and a UIComponent, so you'd have to
mock that sort of stuff up somehow if it's really a non-JSF use case.

Craig

Mime
View raw message