DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=18942>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=18942





------- Additional Comments From [EMAIL PROTECTED]  2005-03-04 03:21 -------
(In reply to comment #7)
> [Eric response]
> I disagree that using this configurable converter is not significantly easier
> than writing your own. BeanUtils is a framework and as such should be as
> configurable as is reasonably possible. Writing a new implementation just to
> handle "T"/"F" is overkill, IMO.

Here's a complete implementation for a "french" boolean converter:

Converter bc = new Converter() {
  public Object convert(Class type, Object value) {
    String s = value.toString();
    if (s.equalsIgnoreCase("o") || s.equalsIgnoreCase("oui"))
      return Boolean.TRUE;
    else if (s.equalsIgnoreCase("n") || s.equalsIgnoreCase("non"))
      return Boolean.FALSE;
    else
      throw new ConversionException(s);
  }
}

ConvertUtils.register(bc, Boolean.class);
ConvertUtils.register(bc, Boolean.TYPE);

This really isn't a whole lot more complicated for the user of BeanUtils than
configuring a configurable BooleanConverter class. Note that I generally favour
something like your original patch (a configurable BooleanConverter); I'm just
pointing out that the current alternative isn't too bad.


> Also, the current ConvertUtils by default registers two separate 
> (but identical) converters for Boolean and boolean, which I think
> is a mistake. I would amend my patch to use the same converter 
> for both types. It doesn't matter if the user chooses form A or
> form B that you describe above - they amount to the same thing.

Not quite. If BooleanArrayConverter is modified so it has a reference to the
default BooleanConverter, then form A will also change the
BooleanArrayConverter's behavior while form B will not.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to