-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor NumberConversionUtil and toString() of CookieList & XML Classes. #831
Conversation
…isNumericChar(...)' in NumberConversionUtil.
Hello @stleary and @johnjaylward, Can this be reviewed and merged please? |
This comment was marked as resolved.
This comment was marked as resolved.
@adityap27 Out of sync, please merge master to your branch. |
@stleary - done, now in sync. |
What problem does this code solve? Does the code still compile with Java6? Risks Changes to the API? Will this require a new release? Should the documentation be updated? Does it break the unit tests? Was any code refactored in this commit? Review status Starting 3-day comment window |
Hello @stleary,
I have made 3 refactorings.
1. Renamed Variable boolean b in toString() method of CookieList Class.
boolean
isEndOfPair
is more meaningful as compared to just booleanb
.2. Introduced indentationSuffix variable in toString() method of XML Class.
There are multiple long expressions which are using
(indentFactor > 0) ? "\n" : ""
sub-expression.indentationSuffix
is introduced to replace this sub-expression to improve readability and reduce duplication.3. Added method isNumericChar(...) in NumberConversionUtil Class.
There are some digit-related conditions which may look complex to some developers due to multiple conditional operators.
Eg:
if ((initial >= '0' && initial <= '9') || initial == '-' )
and
if(at1 == '0' && at2 >= '0' && at2 <= '9')
The sub-condition
c >= '0' && c <= '9'
is moved to a methodisNumericChar(...)
to reduce the complexity of these conditions and better readability.Notes:

All the unit tests are passing successfully.
This code is compatible with Java 6.