Source:
<code>public static void validateEfoConfiguration(Properties config, List<String> streams) { <START> String efoRegistrationType; <END> if (config.containsKey(ConsumerConfigConstants.EFO_REGISTRATION_TYPE)) { efoRegistrationType = config.getProperty(ConsumerConfigConstants.EFO_REGISTRATION_TYPE); try { EFORegistrationType.valueOf(efoRegistrationType); } catch (IllegalArgumentException e) { String errorMessage = Arrays.stream(EFORegistrationType.values()) .map(Enum::name).collect(Collectors.joining(", ")); throw new IllegalArgumentException("Invalid efo registration type in stream set in config. Valid values are: " + errorMessage); } } else { efoRegistrationType = EFORegistrationType.LAZY.toString(); } if (EFORegistrationType.valueOf(efoRegistrationType) == EFORegistrationType.NONE) { List<String> missingConsumerArnKeys = new ArrayList<>(); for (String stream : streams) { String efoConsumerARNKey = ConsumerConfigConstants.EFO_CONSUMER_ARN_PREFIX + "." + stream; if (!config.containsKey(efoConsumerARNKey)) { missingConsumerArnKeys.add(efoConsumerARNKey); } } if (!missingConsumerArnKeys.isEmpty()) { String errorMessage = Arrays .stream(missingConsumerArnKeys.toArray()) .map(Object::toString) .collect(Collectors.joining(", ")); throw new IllegalArgumentException("Invalid efo consumer arn settings for not providing consumer arns: " + errorMessage); } } else { if (!config.containsKey(ConsumerConfigConstants.EFO_CONSUMER_NAME)) { throw new IllegalArgumentException("No valid enhanced fan-out consumer name is set through " + ConsumerConfigConstants.EFO_CONSUMER_NAME); } } }</code><technical_language>@xiaolong-sn nit: this String enum instead, need convert</technical_language>

Target:
public static void validateEfoConfiguration(Properties config, List<String> streams) { EFORegistrationType efoRegistrationType; if (config.containsKey(ConsumerConfigConstants.EFO_REGISTRATION_TYPE)) { String typeInString = config.getProperty(ConsumerConfigConstants.EFO_REGISTRATION_TYPE); try { efoRegistrationType = EFORegistrationType.valueOf(typeInString); } catch (IllegalArgumentException e) { String errorMessage = Arrays.stream(EFORegistrationType.values()) .map(Enum::name).collect(Collectors.joining(", ")); throw new IllegalArgumentException("Invalid efo registration type in stream set in config. Valid values are: " + errorMessage); } } else { efoRegistrationType = EFORegistrationType.LAZY; } if (efoRegistrationType == EFORegistrationType.NONE) { List<String> missingConsumerArnKeys = new ArrayList<>(); for (String stream : streams) { String efoConsumerARNKey = ConsumerConfigConstants.EFO_CONSUMER_ARN_PREFIX + "." + stream; if (!config.containsKey(efoConsumerARNKey)) { missingConsumerArnKeys.add(efoConsumerARNKey); } } if (!missingConsumerArnKeys.isEmpty()) { String errorMessage = Arrays .stream(missingConsumerArnKeys.toArray()) .map(Object::toString) .collect(Collectors.joining(", ")); throw new IllegalArgumentException("Invalid efo consumer arn settings for not providing consumer arns: " + errorMessage); } } else { if (!config.containsKey(ConsumerConfigConstants.EFO_CONSUMER_NAME)) { throw new IllegalArgumentException("No valid enhanced fan-out consumer name is set through " + ConsumerConfigConstants.EFO_CONSUMER_NAME); } } }