Search in sources :

Example 1 with SpelCompilerMode

use of org.springframework.expression.spel.SpelCompilerMode in project spring-framework by spring-projects.

the class SpelExpression method checkCompile.

/**
	 * Compile the expression if it has been evaluated more than the threshold number
	 * of times to trigger compilation.
	 * @param expressionState the expression state used to determine compilation mode
	 */
private void checkCompile(ExpressionState expressionState) {
    this.interpretedCount++;
    SpelCompilerMode compilerMode = expressionState.getConfiguration().getCompilerMode();
    if (compilerMode != SpelCompilerMode.OFF) {
        if (compilerMode == SpelCompilerMode.IMMEDIATE) {
            if (this.interpretedCount > 1) {
                compileExpression();
            }
        } else {
            // compilerMode = SpelCompilerMode.MIXED
            if (this.interpretedCount > INTERPRETED_COUNT_THRESHOLD) {
                compileExpression();
            }
        }
    }
}
Also used : SpelCompilerMode(org.springframework.expression.spel.SpelCompilerMode)

Aggregations

SpelCompilerMode (org.springframework.expression.spel.SpelCompilerMode)1