Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source converter support configure #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
source converter support configure
  • Loading branch information
elgca committed Oct 9, 2019
commit fb8689a20bef83b8fe4cb810fdab39602cca9c6f
21 changes: 15 additions & 6 deletions src/main/java/com/salesforce/mirus/config/TaskConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ public Converter getKeyConverter() {

SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf);

return config.getConfiguredInstance(
SourceConfigDefinition.SOURCE_KEY_CONVERTER.key, Converter.class);
Converter converter = config.getConfiguredInstance(
SourceConfigDefinition.SOURCE_KEY_CONVERTER.key, Converter.class);
converter.configure(
config.originalsWithPrefix(SourceConfigDefinition.SOURCE_KEY_CONVERTER.key + "."),true);
return converter;
}

public Converter getValueConverter() {
Expand All @@ -88,8 +91,11 @@ public Converter getValueConverter() {

SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf);

return config.getConfiguredInstance(
SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key, Converter.class);
Converter converter = config.getConfiguredInstance(
SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key, Converter.class);
converter.configure(
config.originalsWithPrefix(SourceConfigDefinition.SOURCE_VALUE_CONVERTER.key + "."),false);
return converter;
}

public HeaderConverter getHeaderConverter() {
Expand All @@ -98,7 +104,10 @@ public HeaderConverter getHeaderConverter() {

SimpleConfig config = new SimpleConfig(TaskConfigDefinition.configDef(), conf);

return config.getConfiguredInstance(
SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key, HeaderConverter.class);
HeaderConverter headerConverter = config.getConfiguredInstance(
SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key, HeaderConverter.class);
headerConverter.configure(
config.originalsWithPrefix(SourceConfigDefinition.SOURCE_HEADER_CONVERTER.key + "."));
return headerConverter;
}
}