I use JEXL3 to convert user input as string to a math function, I would like to use ^
as Math.pow()
so I read about extending JexlArithemtic
to override bitwiseXor
like here: http://apache-commons.680414.n4.nabble.com/JEXL-Evaluating-math-expression-td4112606.html
This example is for Jexl2 and I use Jexl3, if I try to override:
class JexlArithmeticWithPow(lenient: Boolean) : JexlArithmetic(lenient) {
override fun bitwiseXor(left: Any, right: Any): Any { //bitwiseXor is final and cannot be overriden
val l = toDouble(left)
val r = toDouble(right)
return Math.pow(l, r)
}
}
Is there another possibility to convert ^
to Math.pow
instead of bitwiseXor
?