Scott,

Thank you for pointing that out. I think what I'm trying to achieve is 
predictable behavior from a user or developer's standpoint.

Take an unknown Java object type and convert it to a String. As a developer, 
what would you expect the result to be? From my perspective it would be 
whatever the object's toString() method would return.

Does that make sense?

-Adrian

--- On Tue, 1/19/10, Scott Gray <[email protected]> wrote:

> From: Scott Gray <[email protected]>
> Subject: Re: svn commit: r901058 - 
> /ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NumberConverters.java
> To: [email protected]
> Date: Tuesday, January 19, 2010, 9:16 PM
> On 19/01/2010, at 9:36 PM, [email protected]
> wrote:
> 
> > Author: adrianc
> > Date: Wed Jan 20 04:36:42 2010
> > New Revision: 901058
> > 
> > URL: http://svn.apache.org/viewvc?rev=901058&view=rev
> > Log:
> > Simplified the number converters. Eliminated an
> unnecessary abstract class, made use of Java's auto-boxing.
> Non-localized Number to String conversions use the the
> toString() method - so the result is what you would expect.
> > 
> > -    public static class BigDecimalToString
> extends AbstractUsesLocaleConverter<BigDecimal,
> String> {
> > +    public static class BigDecimalToString
> extends AbstractToNumberConverter<BigDecimal, String>
> {
> >        public BigDecimalToString()
> {
> >           
> super(BigDecimal.class, String.class);
> >        }
> > 
> > +        public String
> convert(BigDecimal obj) throws ConversionException {
> > +            return
> obj.toString();
> > +        }
> > +
> 
> 
> Hi Adrian,
> 
> bigDecimal.toString() can return scientific notation in
> some cases, it's usually better to use
> bigDecimal.toPlainString()
> http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#toString()
> 
> Regards
> Scott



Reply via email to