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

Fixes incomplete PR #947. #976

Merged

Conversation

harawata
Copy link
Member

PR #947 didn't work as expected. An enum type handler needs to take enum type as constructor argument.

…o a new instance of the type handler that takes the enum type as a constructor argument.
@kazuki43zoo
Copy link
Member

@harawata It seem good !! 👍

Copy link
Member

@kazuki43zoo kazuki43zoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added one comment.
Please check it.

HashMap<JdbcType, TypeHandler<?>> newMap = new HashMap<JdbcType, TypeHandler<?>>();
for (Entry<JdbcType, TypeHandler<?>> entry : jdbcHandlerMap.entrySet()) {
// Create a type handler instance with enum type as a constructor arg
newMap.put(entry.getKey(), getInstance(enumClazz, entry.getValue().getClass()));
Copy link
Member

@kazuki43zoo kazuki43zoo Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it is better to register the creating type handler in association with Enum type for performance. What do you think ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I withdraw above comment because it work fine in current implementation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Let's merge this and see how it works!

@harawata harawata merged commit 4d57247 into mybatis:master Apr 16, 2017
@kazuki43zoo kazuki43zoo added this to the 3.4.5 milestone Apr 16, 2017
@kazuki43zoo kazuki43zoo added the enhancement Improve a feature or add a new feature label Apr 16, 2017
@harawata harawata added bug and removed enhancement Improve a feature or add a new feature labels Jul 24, 2017
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants