commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henrib <hen...@apache.org>
Subject Re: [jexl] Number coercion in assignments and method calls
Date Wed, 25 Jul 2012 08:26:34 GMT
Hi;
The easiest solution would be by flanking the problem altogether by adding a
'public void setSomeBigDecimalProperty(Number n)' or 'public void
setSomeBigDecimalProperty(double d)' method  to your 'someBean' class.

The other possible solutions:
1/ derive the Interpreter to override the 'setAttribute' method to 'widen'
(on top of trying to 'narrow') the method argument when dealing with a
number property, i.e. try to find a method by casting the argument to
BigDecimal (uberspect.getPropertySet(...)).
2/ some way to define the default number literal class (so 1 is indeed
evaluated as BigDecimal("1")) but there is no such thing in 2.1; I can try
adding this in 3.0 if you can use snapshots.

Cheers,
Henrib



--
View this message in context: http://apache-commons.680414.n4.nabble.com/jexl-Number-coercion-in-assignments-and-method-calls-tp4636999p4637008.html
Sent from the Commons - User mailing list archive at Nabble.com.

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


Mime
View raw message