-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Allow registering a type handler for a common interface of enums. #947
Allow registering a type handler for a common interface of enums. #947
Conversation
@harawata thanks for your attribution |
Hi @harawata, I have one question. |
@kazuki43zoo , |
…o a new instance of the type handler that takes the enum type as a constructor argument.
…take2 Proper fix for #947 . When there is a type handler registered to a super interface of an enum, new instance of the type handler should be created with the enum type as a constructor argument.
the constractor of custom typehandler has some error
|
|
@harawata if there is many enum,we need write every enum type handler in mybatis-config.xml, like this, Witch makes me feel a little verbose
the handler
|
@mahengyang , There is a working test case, so if you found a bug, please create a failing test case. Note that there is a bug in 3.4.4 and you need to use 3.4.5-SNAPSHOT for now (I assumed you knew it seeing your comment on #976 ). |
Implementation of the feature is still incomplete. XMLConfigBuilder.parse is called by mybatis-spring project for example. |
@michaelplavnik This PR is already merged. Please create a new issue as related this. |
…o a new instance of the type handler that takes the enum type as a constructor argument.
…erface-take2 Proper fix for mybatis#947 . When there is a type handler registered to a super interface of an enum, new instance of the type handler should be created with the enum type as a constructor argument.
It is common for multiple enums to have a common interface along with a corresponding type handler.
Up to version 3.4.2, to use this type handler, users had to list all the enum implementations in the
@MappedType
or<typeHandlers />
.This PR allows users to register the type handler against the common interface.
Please see the attached test case for how it works.
Cc-ing @gaohanghbut @liyuj @yxc023 @charlesluo2014 @Hubbitus @fengdh @fayou @sskeater @jlkm2010
Thought you guys might be interested.