yx91490 commented on a change in pull request #1214:
URL:
https://github.com/apache/incubator-seatunnel/pull/1214#discussion_r805750487
##########
File path:
seatunnel-common/src/main/java/org/apache/seatunnel/common/config/CheckConfigUtil.java
##########
@@ -72,14 +72,14 @@ public static CheckResult checkAtLeastOneExists(Config
config, String... params)
}
}
- public static boolean isInvalidParam(Config config, String param) {
- boolean isInvalidParam = false;
- if (!config.hasPath(param) || config.getAnyRef(param) == null) {
- isInvalidParam = true;
+ public static boolean isValidParam(Config config, String param) {
+ boolean isValidParam = true;
+ if (!config.hasPath(param)) {
+ isValidParam = false;
} else if (config.getAnyRef(param) instanceof List) {
- isInvalidParam = ((List<?>) config.getAnyRef(param)).size() == 0;
+ isValidParam = !((List<?>) config.getAnyRef(param)).isEmpty();
}
- return isInvalidParam;
+ return isValidParam;
Review comment:
can be simplified to `return config.hasPath(param) && !((List<?>)
config.getAnyRef(param)).isEmpty();`
--
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]