commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henrib <>
Subject Re: [jexl] Number coercion in assignments and method calls
Date Wed, 25 Jul 2012 08:26:34 GMT
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.


View this message in context:
Sent from the Commons - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message