The NumberTranslator internally uses java.text.DecimalFormat to
parse/format numbers. Unfortunately, DecimalFormat is only capable of
parsing/formatting numbers with at most double precision or smaller.
To work with BigDecimal (or BigInteger for that matter) you will need to
write your own Translator implementation. Contribute your
implementation to the tapestry.form.translator.Translators configuration
point and you'll be able to leverage the translator binding prefix.
Paul
Ted Steen wrote:
Hi all!
I need to work with BigDecimal in order to represent decimal numbers
with greater precision than float.
If I need to store the (float) number 27.9 in a BigDecimal it
transforms into 27.89999999999999857891452847...
In tapestry I have my @TextField with translator:number
tied to a property "public abstract BigDecimal getAmount();"
problem is that tapestry seem to store 27.9 in a float (or maybe
double) before storing it in the BigDecimal which mess up the number.
:(
Now are there a translator for BigDecimal, should I write my own
translator or should I re-thing the whole thing?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]