private static Map<String, Schema.Type> parseFieldTypes(List<String> mappings) { final Map<String, Schema.Type> m = new HashMap<>(); boolean isWholeValueCast = false; for (String mapping : mappings) { final String[] parts = mapping.split(":"); if (parts.length > 2) { throw new ConfigException(ReplaceField.ConfigName.RENAME, mappings, "Invalid rename mapping: " + mapping); } if (parts.length == 1) { Schema.Type targetType = Schema.Type.valueOf(parts[0].trim().toUpperCase(Locale.ROOT)); m.put(WHOLE_VALUE_CAST, validCastType(targetType, FieldType.OUTPUT)); isWholeValueCast = true; } else { Schema.Type type; try { type = Schema.Type.valueOf(parts[1].trim().toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { throw new ConfigException("Invalid type found in casting spec: " + parts[1].trim(), e); } m.put(parts[0].trim(), validCastType(type, FieldType.OUTPUT)); } } if (isWholeValueCast && mappings.size() > 1) { throw new ConfigException("Cast transformations that specify a type to cast the entire value to " + "may ony specify a single cast in their spec"); } return m; }