Spring Spel supports the following set of the TokenKind elements.
package org.springframework.expression.spel.standard;
/**
* @author Andy Clement
* @since 3.0
*/
enum TokenKind {
// ordered by priority - operands first
LITERAL_INT, LITERAL_LONG, LITERAL_HEXINT, LITERAL_HEXLONG, LITERAL_STRING, LITERAL_REAL, LITERAL_REAL_FLOAT,
LPAREN("("), RPAREN(")"), COMMA(","), IDENTIFIER,
COLON(":"),HASH("#"),RSQUARE("]"), LSQUARE("["),
LCURLY("{"),RCURLY("}"),
DOT("."), PLUS("+"), STAR("*"), MINUS("-"), SELECT_FIRST("^["), SELECT_LAST("$["), QMARK("?"), PROJECT("!["),
DIV("/"), GE(">="), GT(">"), LE("<="), LT("<"), EQ("=="), NE("!="),
MOD("%"), NOT("!"), ASSIGN("="), INSTANCEOF("instanceof"), MATCHES("matches"), BETWEEN("between"),
SELECT("?["), POWER("^"),
ELVIS("?:"), SAFE_NAVI("?."), BEAN_REF("@")
;
I'm wondering is it possible for us to declare a new TokenKind value and custom object which would handle the evaluation, which could be plugged into the existing Spel framework?
It's interest why you want to introduce a new TokenKind
, if those provided just describe the SpEL DSL and play the languge tokens.
I wonder why custom propertyAccessor
, operatorOverloader
or function
isn't enough for you...
Take a look into StandardEvaluationContext
and try to find, why those hi-level hooks can't help you.