Remove unused import and clean up helper processKey fn

This commit is contained in:
Ethan Katnic 2024-09-10 11:40:46 -07:00
parent df0782d34c
commit 88dc89e1a8

View file

@ -24,8 +24,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtilsBean; import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.ConvertUtilsBean; import org.apache.commons.beanutils.ConvertUtilsBean;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.jetbrains.annotations.NotNull;
import software.amazon.awssdk.arns.Arn; import software.amazon.awssdk.arns.Arn;
import software.amazon.kinesis.common.StreamIdentifier; import software.amazon.kinesis.common.StreamIdentifier;
@ -65,8 +63,7 @@ public class KinesisClientLibConfigurator {
properties.entrySet().forEach(e -> { properties.entrySet().forEach(e -> {
try { try {
log.info("Processing (key={}, value={})", e.getKey(), e.getValue()); log.info("Processing (key={}, value={})", e.getKey(), e.getValue());
String key = processKey(e); utilsBean.setProperty(configuration, processKey(e), e.getValue());
utilsBean.setProperty(configuration, key, e.getValue());
} catch (IllegalAccessException | InvocationTargetException ex) { } catch (IllegalAccessException | InvocationTargetException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
@ -93,15 +90,6 @@ public class KinesisClientLibConfigurator {
return configuration; return configuration;
} }
private static String processKey(Map.Entry<Object, Object> e) {
String key = (String) e.getKey();
// utilsBean expects key like 'awsCredentialsProvider' to call setter setAwsCredentialsProvider
if (key.toLowerCase().startsWith("awscredentialsprovider")) {
key = key.replaceAll("(?i)awscredentialsprovider", "awsCredentialsProvider");
}
return key;
}
/** /**
* @param configStream the input stream containing the configuration information * @param configStream the input stream containing the configuration information
* @return KinesisClientLibConfiguration * @return KinesisClientLibConfiguration
@ -123,4 +111,13 @@ public class KinesisClientLibConfigurator {
} }
return getConfiguration(properties); return getConfiguration(properties);
} }
private String processKey(Map.Entry<Object, Object> e) {
String key = (String) e.getKey();
// utilsBean expects key like 'awsCredentialsProvider' to call bean setter setAwsCredentialsProvider
if (key.toLowerCase().startsWith("awscredentialsprovider")) {
key = key.replaceAll("(?i)awscredentialsprovider", "awsCredentialsProvider");
}
return key;
}
} }