-
Notifications
You must be signed in to change notification settings - Fork 13k
Avoid unnecessary object creation when parsing XML tags. #1149
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
Conversation
Good point. Thank you, @zhangweidavid ! @hazendaz , |
I think that this is good PR. |
https://github.com/mybatis/mybatis-3/blob/master/src/main/java/org/apache/ibatis/reflection/factory/DefaultObjectFactory.java |
map.put("otherwise", new OtherwiseHandler()); | ||
map.put("bind", new BindHandler()); | ||
return map.get(nodeName); | ||
return nodeHandlerMap.get(nodeName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this method and call nodeHandlerMap.get()
directly.
It's redundant and the name is inaccurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
Agreed! |
Merged. Thanks again! |
Avoid unnecessary object creation when parsing XML tags.
https://github.com/mybatis/mybatis-3/blob/master/src/main/java/org/apache/ibatis/scripting/xmltags/XMLScriptBuilder.java
These handlers are thread-safe, so they do not need to be created every time。
Using a global Map instead of local variables
#1148