Package net.sf.jasperreports.engine.util
Class Java15BigDecimalHandler
java.lang.Object
net.sf.jasperreports.engine.util.Java15BigDecimalHandler
- All Implemented Interfaces:
BigDecimalHandler
BigDecimalHandler implementation used on Java 1.5 or newer.
This implementation uses a configured minimum precision when performing divisions.
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAn integer property that provides the minimum precision to be used for division operations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondivide(BigDecimal dividend, BigDecimal divisor) Divides the values using the biggest of the dividend precision, the divisor precision and the configured minimum precision as result precision, andRoundingMode.HALF_UPas rounding mode.protected intgetDivisionPrecision(BigDecimal dividend, BigDecimal divisor) protected MathContextgetMathContext(int precision)
-
Field Details
-
PROPERTY_MINIMUM_PRECISION
An integer property that provides the minimum precision to be used for division operations.The property can only be set globally. The default value is 16.
- See Also:
-
-
Constructor Details
-
Java15BigDecimalHandler
public Java15BigDecimalHandler() -
Java15BigDecimalHandler
public Java15BigDecimalHandler(int minPrecision)
-
-
Method Details
-
divide
Divides the values using the biggest of the dividend precision, the divisor precision and the configured minimum precision as result precision, andRoundingMode.HALF_UPas rounding mode.- Specified by:
dividein interfaceBigDecimalHandler- Parameters:
dividend- the dividenddivisor- the divisor- Returns:
- the division result, rounded according to the rules of the specific implementation
- See Also:
-
getDivisionPrecision
-
getMathContext
-