[go: up one dir, main page]

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

Support type alias on OGNL expression #1594

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kazuki43zoo
Copy link
Member

Fixes gh-416

I've tried that support to use type alias on OGNL expression(e.g. <if>, <bind>, ${...}).
WDYT?

@kazuki43zoo
Copy link
Member Author

@mybatis/committers WDYT this PR?

@harawata
Copy link
Member

Thank you, @kazuki43zoo !

This adds extra text processing to every expression on top of OGNL.
It looks a little bit too expensive just to save some typing.

@kazuki43zoo
Copy link
Member Author

@harawata

Thanks for your comment!!

This adds extra text processing to every expression on top of OGNL.

Probably this changes will be affect only expression that access class(e.g. expression with start with @ or new operation). In other words, I think many expressions using with the MyBatis does not affect. Is my opinion wrong?

@harawata
Copy link
Member
harawata commented Mar 26, 2022

@kazuki43zoo ,

I'm sorry about the lack of response.
I didn't forget, but wanted to take a deeper look.

First of all, you are right about the side effect.
I'm sorry about the poor review. :D

Regarding the implementation, passing OgnlClassResolver to various constructor does not look great.

I think, we should drop ExpressionEvaluator and move its functionality (getValue, evaluateBoolean, evaluateIterable) to DynamicContext.
Then, various SqlNode implementations can call those methods from its apply().
In DynamicContext, TypeAliasRegistry can be retrieved from Configuration, of course.

By the way, I don't think we need the fallback for java.lang classes as useful classes are already registered in MyBatis' TypeAliasRegistry.


If my explanation does not make sense, give me some time and I'll try the idea myself (it's possible that I am missing something).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please support typeAliases of configuration on OgnlClassResolver
2 participants