velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Priblouda <kpriblo...@yahoo.com>
Subject Re: comparing monetary value
Date Tue, 15 Oct 2002 07:32:23 GMT

--- STham@thoughtworks.COM wrote:
> 
> Hi,
> 
>    I believed at the moment, all numbers are treated
> as Integer. Anyone
> came across this problem of manipulating with money
> value before?
> 
> Example :
> 
>   Give a certain amount has to be less than a given
> value.
> 
>    if ($someMoneyValue < 0.01) ???
> 
> How do people normally handle money in velocity??
> Thanks.
> 
> cheers,
> shen
AFAIK, velocity does not support comparisons on
anything but integers. I worked around by providing
convenience methods in my model beans.
You may also create "comparator" bean, which will
floats for you
i.e:
public class Foo {
public boolean lessThan(float a, float b) {
  return a < b;
}
}

then in velocity template:
#if( $Foo.lessThan(a,0.01) 


regards,

=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message