Source:
private void parseConfiguration(Config config, FailureCollector collector) { if (!config.defaults.isEmpty()) { String[] defaultsList = config.defaults.split(","); for (String defaultValue : defaultsList) { String[] defaultsArray = defaultValue.split(":"); if (defaultsArray.length != 2) { collector.addFailure( String.format("Invalid default: %s.", defaultValue), "Defaults should contain source field and its corresponding default " + "value in the format: <source-field>:<default-value>[,<source-field>:<default-value>]* " + "For example: lang_code:English,country_code:Britain").withConfigElement(DEFAULTS, defaultValue); } else { defaultsMapping.put(defaultsArray[0], defaultsArray[1]); } } } String[] mappingArray = config.mapping.split(","); for (String mapping : mappingArray) { String[] mappingValueArray = mapping.split(":"); if (mappingValueArray.length != 3) { collector.addFailure(String.format("Invalid mapping: %s.", mapping), "Mapping should contain source field, lookup table name, " + "and target field in the format: " + "<source-field>:<lookup-table-name>:<target-field>" + "[,<source-field>:<lookup-table-name>:<target-field>]* " + "For example: lang_code:language_code_lookup:lang_desc," + "country_code:country_lookup:country_name").withConfigElement(MAPPING, mapping); } else { String defaultValue = null; if (defaultsMapping.containsKey(mappingValueArray[0])) { defaultValue = defaultsMapping.get(mappingValueArray[0]); } ValueMapping valueMapping = new ValueMapping(mappingValueArray[2], mappingValueArray[1], defaultValue); mappingValues.put(mappingValueArray[0], valueMapping); } } collector.getOrThrowException(); }

Target:
private void parseConfiguration(Config config, FailureCollector collector) { if (!config.defaults.isEmpty()) { String[] defaultsList = config.defaults.split(","); for (String defaultValue : defaultsList) { String[] defaultsArray = defaultValue.split(":"); if (defaultsArray.length != 2) { collector.addFailure( String.format("Invalid default: %s.", defaultValue), "Defaults should contain source field and its corresponding default " + "value in the format: <source-field>:<default-value>[,<source-field>:<default-value>]* " + "For example: lang_code:English,country_code:Britain").withConfigElement(Config.DEFAULTS, defaultValue); } else { defaultsMapping.put(defaultsArray[0], defaultsArray[1]); } } } String[] mappingArray = config.mapping.split(","); for (String mapping : mappingArray) { String[] mappingValueArray = mapping.split(":"); if (mappingValueArray.length != 3) { collector.addFailure(String.format("Invalid mapping: %s.", mapping), "Mapping should contain source field, lookup table name, " + "and target field in the format: <source-field>:<lookup-table-name>:<target-field>" + "[,<source-field>:<lookup-table-name>:<target-field>]* " + "For example: lang_code:language_code_lookup:lang_desc," + "country_code:country_lookup:country_name").withConfigElement(Config.MAPPING, mapping); } else { String defaultValue = null; if (defaultsMapping.containsKey(mappingValueArray[0])) { defaultValue = defaultsMapping.get(mappingValueArray[0]); } ValueMapping valueMapping = new ValueMapping(mappingValueArray[2], mappingValueArray[1], defaultValue); mappingValues.put(mappingValueArray[0], valueMapping); } } collector.getOrThrowException(); }