Class RoundFunction
- java.lang.Object
-
- com.api.jsonata4java.expressions.functions.FunctionBase
-
- com.api.jsonata4java.expressions.functions.RoundFunction
-
- All Implemented Interfaces:
Function,Serializable
public class RoundFunction extends FunctionBase implements Function
http://docs.jsonata.org/numeric-functions.html $round(number [, precision]) Returns the value of the number parameter rounded to the number of decimal places specified by the optional precision parameter. The precision parameter (which must be an integer) species the number of decimal places to be present in the rounded number. If precision is not specified then it defaults to the value 0 and the number is rounded to the nearest integer. If precision is negative, then its value specifies which column to round to on the left side of the decimal place This function uses the Round half to even strategy to decide which way to round numbers that fall exactly between two candidates at the specified precision. This strategy is commonly used in financial calculations and is the default rounding mode in IEEE 754. Examples $round(123.456)==123 $round(123.456, 2)==123.46 $round(123.456, -1) == 120 $round(123.456, -2)==100 $round(11.5)==12 $round(12.5)==12 $round(125, -1)==120- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringERR_ARG1BADTYPEstatic StringERR_ARG2BADTYPEstatic StringERR_ARG3BADTYPEstatic StringERR_BAD_CONTEXT
-
Constructor Summary
Constructors Constructor Description RoundFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxArgs()intgetMinArgs()StringgetSignature()com.fasterxml.jackson.databind.JsonNodeinvoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx)-
Methods inherited from class com.api.jsonata4java.expressions.functions.FunctionBase
getArgumentCount, getFunctionName
-
-
-
-
Method Detail
-
invoke
public com.fasterxml.jackson.databind.JsonNode invoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx)
-
getMaxArgs
public int getMaxArgs()
- Specified by:
getMaxArgsin interfaceFunction
-
getMinArgs
public int getMinArgs()
- Specified by:
getMinArgsin interfaceFunction
-
getSignature
public String getSignature()
- Specified by:
getSignaturein interfaceFunction
-
-