Class MeasureUtils
java.lang.Object
overit.geocallapp.wfm.orchestrator.assets.bl.measuringelement.measure.MeasureUtils
Utility class for handling measure-related operations and validations.
This class provides utility methods for:
- Validating numeric constraints on measure values
- Checking precision limits for decimal values
- Handling measure value constraints based on characteristics
This class cannot be instantiated and all methods are static.
- Since:
- 20.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckPrecisionUnderLimit(double value, int precisionLimit) Checks if a decimal value's precision is within the specified limit.static voidvalidateNumericConstraints(Double value, BOCharacteristic characteristic) Validates numeric constraints on a measure value based on characteristic specifications.
-
Method Details
-
validateNumericConstraints
public static void validateNumericConstraints(Double value, BOCharacteristic characteristic) throws DAValidateException Validates numeric constraints on a measure value based on characteristic specifications.Performs the following validations:
- Checks if the value's precision is within the characteristic's precision limit
- Validates the value against maximum length constraints when precision is not specified
- Ensures the value falls within allowed numeric range
- Parameters:
value- the measure value to validatecharacteristic- the characteristic containing precision and length constraints- Throws:
DAValidateException- if the value violates any constraints:- Precision exceeds the limit
- Value exceeds maximum allowed length
- Value falls outside the allowed range
-
checkPrecisionUnderLimit
public static boolean checkPrecisionUnderLimit(double value, int precisionLimit) Checks if a decimal value's precision is within the specified limit.The method:
- Converts the double to BigDecimal for precise decimal handling
- Rounds the value to the specified precision limit
- Compares the rounded value with the original to determine if precision is respected
- Parameters:
value- the decimal value to checkprecisionLimit- maximum number of decimal places allowed- Returns:
trueif the value's precision is within the limit,falseotherwise
-