public class JexlThreadedArithmetic extends JexlArithmetic
BIGD_DOUBLE_MAX_VALUE, BIGD_DOUBLE_MIN_VALUE, BIGD_SCALE, BIGI_LONG_MAX_VALUE, BIGI_LONG_MIN_VALUE, mathContext, mathScale
Constructor and Description |
---|
JexlThreadedArithmetic(boolean lenient)
Standard ctor.
|
JexlThreadedArithmetic(boolean lenient,
MathContext bigdContext,
int bigdScale)
Creates a JexlThreadedArithmetic instance.
|
Modifier and Type | Method and Description |
---|---|
MathContext |
getMathContext()
The MathContext instance used for +,-,/,*,% operations on big decimals.
|
int |
getMathScale()
The BigDecimal scale used for comparison and coercion operations.
|
boolean |
isLenient()
Checks whether this JexlArithmetic instance triggers errors during evaluation
when null is used as an operand.
|
static void |
setLenient(Boolean flag)
Overrides the default behavior and sets whether this JexlArithmetic instance triggers errors
during evaluation when null is used as an operand for the current thread.
|
static void |
setMathContext(MathContext mc)
Sets the math context.
|
static void |
setMathScale(Integer scale)
Sets the math scale.
|
add, bitwiseAnd, bitwiseComplement, bitwiseOr, bitwiseXor, compare, controlNullNullOperands, controlNullOperand, divide, equals, greaterThan, greaterThanOrEqual, isFloatingPoint, isFloatingPointNumber, isFloatingPointType, isNumberable, lessThan, lessThanOrEqual, matches, mod, multiply, narrow, narrowAccept, narrowArguments, narrowArrayType, narrowBigDecimal, narrowBigInteger, narrowNumber, negate, roundBigDecimal, subtract, toBigDecimal, toBigInteger, toBoolean, toDouble, toInteger, toLong, toString
public JexlThreadedArithmetic(boolean lenient)
lenient
- lenient versus strict evaluation flagpublic JexlThreadedArithmetic(boolean lenient, MathContext bigdContext, int bigdScale)
lenient
- whether this arithmetic is lenient or strictbigdContext
- the math context instance to use for +,-,/,*,% operations on big decimals.bigdScale
- the scale used for big decimals.public static void setLenient(Boolean flag)
It is advised to protect calls by either calling JexlThreadedArithmetic.setLenient explicitly before evaluation or add a try/finally clause resetting the flag to avoid unexpected reuse of the lenient flag value through thread pools side-effects.
flag
- true means no JexlException will occur, false allows them, null reverts to default behaviorJexlEngine.setSilent(boolean)
,
JexlEngine.setDebug(boolean)
public static void setMathScale(Integer scale)
The goal and constraints are the same than for setLenient.
scale
- the scalepublic static void setMathContext(MathContext mc)
The goal and constraints are the same than for setLenient.
mc
- the math contextpublic boolean isLenient()
isLenient
in class JexlArithmetic
public int getMathScale()
JexlArithmetic
getMathScale
in class JexlArithmetic
public MathContext getMathContext()
JexlArithmetic
getMathContext
in class JexlArithmetic
Copyright © 2016 Internet2. All rights reserved.