/** * Parses business day convention from the input string. * <p> * Parsing is case insensitive. * It leniently handles a variety of known variants of business day conventions. * * @param str the string to parse * @return the parsed value * @throws IllegalArgumentException if the string cannot be parsed */ public static BusinessDayConvention parseBusinessDayConvention(String str) { return BusinessDayConvention.extendedEnum().findLenient(str) .orElseThrow(() -> new IllegalArgumentException( "Unknown BusinessDayConvention value, must be one of " + BusinessDayConvention.extendedEnum().lookupAllNormalized().keySet() + " but was '" + str + "'")); }
/** * Parses day count from the input string. * <p> * Parsing is case insensitive. * It leniently handles a variety of known variants of day counts. * * @param str the string to parse * @return the parsed value * @throws IllegalArgumentException if the string cannot be parsed */ public static DayCount parseDayCount(String str) { return DayCount.extendedEnum().findLenient(str) .orElseThrow(() -> new IllegalArgumentException( "Unknown DayCount value, must be one of " + DayCount.extendedEnum().lookupAllNormalized().keySet() + " but was '" + str + "'")); }
/** * Parses roll convention from the input string. * <p> * Parsing is case insensitive. * It leniently handles a variety of known variants of roll conventions. * * @param str the string to parse * @return the parsed value * @throws IllegalArgumentException if the string cannot be parsed */ public static RollConvention parseRollConvention(String str) { return RollConvention.extendedEnum().findLenient(str) .orElseThrow(() -> new IllegalArgumentException( "Unknown RollConvention value, must be one of " + RollConvention.extendedEnum().lookupAllNormalized().keySet() + " but was '" + str + "'")); }
/** * Obtains an instance of the parser, based on the specified selector and trade info plugin. * <p> * The FpML parser has a number of plugin points that can be controlled: * <ul> * <li>the {@linkplain FpmlPartySelector party selector} * <li>the {@linkplain FpmlTradeInfoParserPlugin trade info parser} * <li>the {@linkplain FpmlParserPlugin trade parsers} * <li>the {@linkplain ReferenceData reference data} * </ul> * This method uses the trade parsers registered in {@link FpmlParserPlugin} configuration * and the {@linkplain ReferenceData#standard() standard} reference data. * * @param ourPartySelector the selector used to find "our" party within the set of parties in the FpML document * @param tradeInfoParser the trade info parser * @return the document parser */ public static FpmlDocumentParser of( FpmlPartySelector ourPartySelector, FpmlTradeInfoParserPlugin tradeInfoParser) { return of(ourPartySelector, tradeInfoParser, FpmlParserPlugin.extendedEnum().lookupAllNormalized()); }
.put("ANOTHER2", SampleNamedInstanceLookup2.ANOTHER2) .build()); assertEquals(test.lookupAllNormalized(), ImmutableMap.builder() .put("Standard", SampleNameds.STANDARD)