//------------------------------------------------------------------------- /// <summary> /// Converts an FpML day count string to a {@code DayCount}. /// </summary> /// <param name="fpmlDayCountName"> the day count name used by FpML </param> /// <returns> the day count </returns> /// <exception cref="IllegalArgumentException"> if the day count is not known </exception> public DayCount convertDayCount(string fpmlDayCountName) { return(DayCount.extendedEnum().externalNames(ENUM_FPML).lookup(fpmlDayCountName)); }
//------------------------------------------------------------------------- /// <summary> /// Parses day count from the input string. /// <para> /// Parsing is case insensitive. /// It leniently handles a variety of known variants of day counts. /// /// </para> /// </summary> /// <param name="str"> the string to parse </param> /// <returns> the parsed value </returns> /// <exception cref="IllegalArgumentException"> if the string cannot be parsed </exception> public static DayCount parseDayCount(string str) { return(DayCount.extendedEnum().findLenient(str).orElseThrow(() => new System.ArgumentException("Unknown DayCount value, must be one of " + DayCount.extendedEnum().lookupAllNormalized().Keys + " but was '" + str + "'"))); }