garydgregory commented on code in PR #364:
URL: https://github.com/apache/commons-beanutils/pull/364#discussion_r2267668244
##########
src/main/java/org/apache/commons/beanutils2/converters/ColorConverter.java:
##########
@@ -90,42 +90,38 @@ protected <T> T convertToType(final Class<T> type, final
Object value) throws Th
if (Color.class.isAssignableFrom(type)) {
final String stringValue = toString(value);
- switch (toLowerCase(stringValue)) {
- case "black":
+ if (stringValue.equalsIgnoreCase("black")) {
return type.cast(Color.BLACK);
- case "blue":
+ } else if (stringValue.equalsIgnoreCase("blue")) {
Review Comment:
-1 This is terrible IMO for two reasons: 1) the one-step switch logic has
devolved into a cascading if-else and 2) equals() is replaced by the ignore
case version. This is worse all for catering to your needs. Previously the
constructor performed a conversion once, now you've got equalsIgnoreCade all
over the place.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]