Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom expression parsing in CachedExpressionEvaluator #27604

Closed

Conversation

Xjzon
Copy link
Contributor

@Xjzon Xjzon commented Oct 24, 2021

When I use CachedExpressionEvaluator, i need parseContext to influence an expression, so add ParseContext param

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 24, 2021
@Xjzon Xjzon force-pushed the improve-CachedExpressionEvaluator branch 2 times, most recently from 756aaa2 to 145e9b8 Compare October 24, 2021 11:46
@snicoll
Copy link
Member

snicoll commented Oct 25, 2021

Thanks for the PR. Rather than making an extra method, I am wondering if we couldn't add a protected method that does the parsing of the expression instead. Would that work if you would override that method with the parser context?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Oct 25, 2021
@sbrannen sbrannen changed the title add parseConext param for CachedExpressionEvaluator#getExpression Add ParserContext parameter to CachedExpressionEvaluator#getExpression Oct 25, 2021
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Oct 25, 2021
@Xjzon
Copy link
Contributor Author

Xjzon commented Oct 27, 2021

the class ExpressionKey is protected and the createKey method is default. override not work. I think add a method is more More appropriate.

@Xjzon
Copy link
Contributor Author

Xjzon commented Oct 27, 2021

Thanks for the PR. Rather than making an extra method, I am wondering if we couldn't add a protected method that does the parsing of the expression instead. Would that work if you would override that method with the parser context?

the class ExpressionKey is protected and the createKey method is default. override not work. I think add a method is more More appropriate.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 27, 2021
@snicoll
Copy link
Member

snicoll commented Oct 27, 2021

the class ExpressionKey is protected and the createKey method is default.

Thanks but I am not talking about that. More about a protected method where you could control how parsing is done, something like:

protected Expression parseExpression(String expression)

that you could override to provide the additional context.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Oct 27, 2021
@Xjzon
Copy link
Contributor Author

Xjzon commented Oct 27, 2021

Thanks but I am not talking about that. More about a protected method where you could control how parsing is done, something like:

protected Expression parseExpression(String expression)

that you could override to provide the additional context.

Oh, It work

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 27, 2021
@Xjzon Xjzon force-pushed the improve-CachedExpressionEvaluator branch from 8ad7a62 to 5c3bbe3 Compare October 27, 2021 16:15
@Xjzon Xjzon force-pushed the improve-CachedExpressionEvaluator branch from 5c3bbe3 to acfc7bb Compare October 27, 2021 16:19
@Xjzon
Copy link
Contributor Author

Xjzon commented Oct 27, 2021

I push code again, pls check

@snicoll snicoll changed the title Add ParserContext parameter to CachedExpressionEvaluator#getExpression Add support for custom expression parsing in CachedExpressionEvaluator Oct 28, 2021
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Oct 28, 2021
@snicoll snicoll self-assigned this Oct 28, 2021
@snicoll snicoll added this to the 5.3.13 milestone Oct 28, 2021
snicoll pushed a commit that referenced this pull request Oct 28, 2021
snicoll added a commit that referenced this pull request Oct 28, 2021
@snicoll snicoll closed this in 47d3819 Oct 28, 2021
@snicoll
Copy link
Member

snicoll commented Oct 28, 2021

@Xjzon thank you for making your first contribution to Spring Framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants