Source:
static Map<CurveName, LoadedCurveSettings> parseCurveSettings(CharSource settingsResource) { ImmutableMap.Builder<CurveName, LoadedCurveSettings> builder = ImmutableMap.builder(); CsvFile csv = CsvFile.of(settingsResource, true); for (CsvRow row : csv.rows()) { String curveNameStr = row.getField(SETTINGS_CURVE_NAME); String valueTypeStr = row.getField(SETTINGS_VALUE_TYPE); String dayCountStr = row.getField(SETTINGS_DAY_COUNT); String interpolatorStr = row.getField(SETTINGS_INTERPOLATOR); String leftExtrapolatorStr = row.getField(SETTINGS_LEFT_EXTRAPOLATOR); String rightExtrapolatorStr = row.getField(SETTINGS_RIGHT_EXTRAPOLATOR); if (!VALUE_TYPE_MAP.containsKey(valueTypeStr.toLowerCase(Locale.ENGLISH))) { throw new IllegalArgumentException( Messages.format("Unsupported in curve settings: {}", SETTINGS_VALUE_TYPE, valueTypeStr)); } CurveName curveName = CurveName.of(curveNameStr); ValueType valueType = VALUE_TYPE_MAP.get(valueTypeStr.toLowerCase(Locale.ENGLISH)); CurveInterpolator interpolator = CurveInterpolator.of(interpolatorStr); CurveExtrapolator leftExtrapolator = CurveExtrapolator.of(leftExtrapolatorStr); CurveExtrapolator rightExtrapolator = CurveExtrapolator.of(rightExtrapolatorStr); LoadedCurveSettings settings = (valueType.equals(ValueType.PRICE_INDEX)) ? LoadedCurveSettings.of(curveName, ValueType.MONTHS, valueType, DayCounts.ACT_360, interpolator, leftExtrapolator, rightExtrapolator) : LoadedCurveSettings.of(curveName, ValueType.YEAR_FRACTION, valueType, DayCount.of(dayCountStr), interpolator, leftExtrapolator, rightExtrapolator); builder.put(curveName, settings); } return builder.build(); }

Target:
static Map<CurveName, LoadedCurveSettings> parseCurveSettings(CharSource settingsResource) { ImmutableMap.Builder<CurveName, LoadedCurveSettings> builder = ImmutableMap.builder(); CsvFile csv = CsvFile.of(settingsResource, true); for (CsvRow row : csv.rows()) { String curveNameStr = row.getField(SETTINGS_CURVE_NAME); String valueTypeStr = row.getField(SETTINGS_VALUE_TYPE); String dayCountStr = row.getField(SETTINGS_DAY_COUNT); String interpolatorStr = row.getField(SETTINGS_INTERPOLATOR); String leftExtrapolatorStr = row.getField(SETTINGS_LEFT_EXTRAPOLATOR); String rightExtrapolatorStr = row.getField(SETTINGS_RIGHT_EXTRAPOLATOR); if (!VALUE_TYPE_MAP.containsKey(valueTypeStr.toLowerCase(Locale.ENGLISH))) { throw new IllegalArgumentException( Messages.format("Unsupported in curve settings: {}", SETTINGS_VALUE_TYPE, valueTypeStr)); } CurveName curveName = CurveName.of(curveNameStr); ValueType valueType = VALUE_TYPE_MAP.get(valueTypeStr.toLowerCase(Locale.ENGLISH)); CurveInterpolator interpolator = CurveInterpolator.of(interpolatorStr); CurveExtrapolator leftExtrapolator = CurveExtrapolator.of(leftExtrapolatorStr); CurveExtrapolator rightExtrapolator = CurveExtrapolator.of(rightExtrapolatorStr); LoadedCurveSettings settings = (valueType.equals(ValueType.PRICE_INDEX)) ? LoadedCurveSettings.of(curveName, ValueType.MONTHS, valueType, DayCounts.ONE_ONE, interpolator, leftExtrapolator, rightExtrapolator) : LoadedCurveSettings.of(curveName, ValueType.YEAR_FRACTION, valueType, DayCount.of(dayCountStr), interpolator, leftExtrapolator, rightExtrapolator); builder.put(curveName, settings); } return builder.build(); }