-
Notifications
You must be signed in to change notification settings - Fork 56
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
fix convert of Boolean #846 #922
fix convert of Boolean #846 #922
Conversation
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.
@btkobayashirun Please consider.
map.putAll(formattingBoolean(name, value)); | ||
return true; | ||
} | ||
} | ||
if (value == null) { | ||
String resetKey = "_" + key; | ||
map.put(resetKey, ""); |
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 think you should be as follows.
Because map.put(resetKey, "");
and formattingBoolean#map.put(name, "");
has the same role.
It Makes easier to understand with WebDataBinder#getEmptyValue
.
String key = StringUtils.isEmpty(prefix) ? name : prefix + "." + name;
if (value == null) {
String resetKey = determineResetKey(key, sourceType);
map.put(resetKey, "");
return true;
}
// omit
// Determine whether to convert null value to field marker.
private String determineResetKey(String key, TypeDescriptor sourceType) {
// Should not convert Boolean null value to field marker.
// WebDataBinder bind boolean & Boolean field marker as same false value.
if (Boolean.class == sourceType.getType()) {
return key;
}
return "_" + key;
}
How do you think?
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 agree with you.
Only null check for sourceType
is added to the implementation.
5556457
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.
Please merge .
Please review #846.