/
How to Import Static Variable as BigDecimal

How to Import Static Variable as BigDecimal

BigDecimal.valueOf(value) and new BigDecimal(value) gives "Unexpected type: java.math.BigDecimal" exception. You have to use this instead:

Basic principle
def price = api.global.price as BigDecimal 
// local variable price is now BigDecimal

Related content

Explicit Function Parameter and Return Types
Explicit Function Parameter and Return Types
More like this
Why NOT to Use 'float' or 'double' Types in Groovy
Why NOT to Use 'float' or 'double' Types in Groovy
More like this
How to Set the Number of Displayed Decimals in User Input
How to Set the Number of Displayed Decimals in User Input
More like this
Calling Library Functions with Aliases
Calling Library Functions with Aliases
More like this

Found an issue in documentation? Write to us.