You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/06/29 09:16:33 UTC

DO NOT REPLY [Bug 29857] New: - ConvertUtils instead of TypeUtils

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=29857>.
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=29857

ConvertUtils instead of TypeUtils

           Summary: ConvertUtils instead of TypeUtils
           Product: Commons
           Version: 1.1 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: JXPath
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: xdury@hotmail.com


ConvertUtils from commons BeanUtils package should be used instead of TypeUtils 
for type conversions because it is more 'pluggable' (you can add/register any 
converter you want).

Until it's changed, I'm using something like this (I'm not sure this is a good 
solution):

TypeUtils.setTypeConverter(new TypeConverter() {
  public boolean canConvert(Object object, Class toType) {
    return ConvertUtils.lookup(toType) != null;
  }
  public Object convert(Object object, Class toType) {
    return ConvertUtils.convert(object.toString(), toType);
  }
});

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org