[
https://issues.apache.org/jira/browse/KAFKA-21150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
majialong reassigned KAFKA-21150:
---------------------------------
Assignee: majialong (was: Chia-Ping Tsai)
> Refactor AbstractKafkaConfig#processRoles
> -----------------------------------------
>
> Key: KAFKA-21150
> URL: https://issues.apache.org/jira/browse/KAFKA-21150
> Project: Kafka
> Issue Type: Improvement
> Reporter: Chia-Ping Tsai
> Assignee: majialong
> Priority: Minor
>
>
> {code:java}
> public Set<ProcessRole> processRoles() {
> Set<ProcessRole> result = new HashSet<>();
> for (String role : getList(KRaftConfigs.PROCESS_ROLES_CONFIG)) {
> switch (role) {
> case "broker" -> result.add(ProcessRole.BrokerRole);
> case "controller" -> result.add(ProcessRole.ControllerRole);
> default -> throw new ConfigException("Unknown process role '"
> + role +
> "' (only 'broker' and 'controller' are allowed
> roles)");
> }
> }
> return Collections.unmodifiableSet(result);
> } {code}
> We could add a helper method to {{ProcessRole}} that converts a string to a
> {{{}ProcessRole{}}}, and then rewrite {{processRoles()}} in a fluent style.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)