Satwik Agrawal
Satwik Agrawal

Reputation: 1

Is it possible to have a data type defining constraint while Parsing SpeL Expression?

I am trying to parse a speL expression fo validation purposes. But while parsing it I actually want to parser to consider the data type of # parameters while parsing For example:

!#res== "STRING"

the value that res actually has is of Type opject so this expression is invalid as ! can be applied to objects but normal parsing actually doesn't give erro on this.

Additional Doubt:

Expression #user.getName()==true

parser actually check data type of user , consider it is an object of User class secondly if that object contains .getName function if yes what return type -> here String now check if left & right of == have same type or not.

I tried using StandardEvaluationContext and provided dummy variable context but problem was it was evaluating with actual values , but I only want type checking. for that too searched for ParserContext but didn't get any solution.

Upvotes: 0

Views: 28

Answers (0)

Related Questions