Source:
private void init() { if (!Strings.isNullOrEmpty(projectionTransformConfig.drop) && !Strings.isNullOrEmpty(projectionTransformConfig.keep)) { throw new IllegalArgumentException("Cannot specify both drop and keep. One should be empty or null"); } if (!Strings.isNullOrEmpty(projectionTransformConfig.drop)) { for (String dropField : Splitter.on(fieldDelimiter).split(projectionTransformConfig.drop)) { fieldsToDrop.add(dropField); } } else if (!Strings.isNullOrEmpty(projectionTransformConfig.keep)) { for (String keepField : Splitter.on(fieldDelimiter).split(projectionTransformConfig.keep)) { fieldsToKeep.add(keepField); } } KeyValueListParser kvParser = new KeyValueListParser("\\s*,\\s*", ":"); if (!Strings.isNullOrEmpty(projectionTransformConfig.rename)) { for (KeyValue<String, String> keyVal : kvParser.parse(projectionTransformConfig.rename)) { String key = keyVal.getKey(); String val = keyVal.getValue(); try { String oldVal = fieldsToRename.put(key, val); if (oldVal != null) { throw new IllegalArgumentException(String.format("Cannot rename %s to both %s and %s.", key, oldVal, val)); } } catch (IllegalArgumentException e) { throw new IllegalArgumentException(String.format("Cannot rename more than one field to %s.", val)); } } } if (!Strings.isNullOrEmpty(projectionTransformConfig.convert)) { for (KeyValue<String, String> keyVal : kvParser.parse(projectionTransformConfig.convert)) { String name = keyVal.getKey(); String typeStr = keyVal.getValue(); Schema.Type type = Schema.Type.valueOf(typeStr.toUpperCase()); if (!type.isSimpleType() || type == Schema.Type.NULL) { throw new IllegalArgumentException("Only non-null simple types are supported."); } if (fieldsToConvert.containsKey(name)) { throw new IllegalArgumentException(String.format("Cannot convert %s to multiple types.", name)); } fieldsToConvert.put(name, type); } } }

Target:
private void init() { if (!Strings.isNullOrEmpty(projectionTransformConfig.drop) && !Strings.isNullOrEmpty(projectionTransformConfig.keep)) { throw new IllegalArgumentException("Cannot specify both drop and keep. One should be empty or null"); } if (!Strings.isNullOrEmpty(projectionTransformConfig.drop)) { Iterables.addAll(fieldsToDrop, Splitter.on(fieldDelimiter).split(projectionTransformConfig.drop)); } else if (!Strings.isNullOrEmpty(projectionTransformConfig.keep)) { Iterables.addAll(fieldsToKeep, Splitter.on(fieldDelimiter).split(projectionTransformConfig.keep)); } KeyValueListParser kvParser = new KeyValueListParser("\\s*,\\s*", ":"); if (!Strings.isNullOrEmpty(projectionTransformConfig.rename)) { for (KeyValue<String, String> keyVal : kvParser.parse(projectionTransformConfig.rename)) { String key = keyVal.getKey(); String val = keyVal.getValue(); try { String oldVal = fieldsToRename.put(key, val); if (oldVal != null) { throw new IllegalArgumentException(String.format("Cannot rename %s to both %s and %s.", key, oldVal, val)); } } catch (IllegalArgumentException e) { throw new IllegalArgumentException(String.format("Cannot rename more than one field to %s.", val)); } } } if (!Strings.isNullOrEmpty(projectionTransformConfig.convert)) { for (KeyValue<String, String> keyVal : kvParser.parse(projectionTransformConfig.convert)) { String name = keyVal.getKey(); String typeStr = keyVal.getValue(); Schema.Type type = Schema.Type.valueOf(typeStr.toUpperCase()); if (!type.isSimpleType() || type == Schema.Type.NULL) { throw new IllegalArgumentException("Only non-null simple types are supported."); } if (fieldsToConvert.containsKey(name)) { throw new IllegalArgumentException(String.format("Cannot convert %s to multiple types.", name)); } fieldsToConvert.put(name, type); } } }