Github user jaredjstewart commented on a diff in the pull request: https://github.com/apache/geode/pull/596#discussion_r123822645 --- Diff: geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java --- @@ -130,31 +125,8 @@ public Result executeFunction( return result; } - if (onRegion != null && onMember != null && onGroups != null) { - ErrorResultData errorResultData = - ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT) - .addLine(CliStrings.EXECUTE_FUNCTION__MSG__OPTIONS); - result = ResultBuilder.buildResult(errorResultData); - return result; - } else if (onRegion != null && onMember != null) { - ErrorResultData errorResultData = - ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT) - .addLine(CliStrings.EXECUTE_FUNCTION__MSG__OPTIONS); - result = ResultBuilder.buildResult(errorResultData); - return result; - } else if (onMember != null && onGroups != null) { - ErrorResultData errorResultData = - ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT) - .addLine(CliStrings.EXECUTE_FUNCTION__MSG__OPTIONS); - result = ResultBuilder.buildResult(errorResultData); - return result; - } else if (onRegion != null && onGroups != null) { - ErrorResultData errorResultData = - ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT) - .addLine(CliStrings.EXECUTE_FUNCTION__MSG__OPTIONS); - result = ResultBuilder.buildResult(errorResultData); - return result; - } else if (onRegion != null && onMember != null && onGroups != null) { + if (isMoreThanOneIsTrue(onRegion != null, onMember != null, onGroups != null)) { --- End diff -- I like the readability introduced by this `isMoreThanOneIsTrue` method. It might make sense to take the abstraction one step further: ``` if (isMoreThanOneNonNull(onRegion, onMember, onGroup) { ``` ``` private boolean isMoreThanOneNonNull(Object... values) { return Stream.of(values).filter(Objects::nonNull).count() > 1; } ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---