//------------------------------------------------------------------------- /// <summary> /// Creates an instance, based on the specified element. /// </summary> /// <param name="ourPartySelector"> the selector used to find "our" party within the set of parties in the FpML document </param> /// <param name="tradeInfoParser"> the trade info parser </param> /// <param name="tradeParsers"> the map of trade parsers, keyed by the FpML element name </param> private FpmlDocumentParser(FpmlPartySelector ourPartySelector, FpmlTradeInfoParserPlugin tradeInfoParser, IDictionary <string, FpmlParserPlugin> tradeParsers, ReferenceData refData) { this.ourPartySelector = ourPartySelector; this.tradeInfoParser = tradeInfoParser; this.tradeParsers = tradeParsers; this.refData = refData; }
//------------------------------------------------------------------------- /// <summary> /// Creates an instance, based on the specified element. /// <para> /// The map of references is used to link one part of the XML to another. /// For example, if one part of the XML has {@code <foo id="fooId">}, the references /// map will contain an entry mapping "fooId" to the parsed element {@code <foo>}. /// /// </para> /// </summary> /// <param name="fpmlRootEl"> the source of the FpML XML document </param> /// <param name="references"> the map of id/href to referenced element </param> /// <param name="ourPartySelector"> the selector used to find "our" party within the set of parties in the FpML document </param> /// <param name="tradeInfoParser"> the trade info parser </param> /// <param name="refData"> the reference data to use </param> public FpmlDocument(XmlElement fpmlRootEl, IDictionary <string, XmlElement> references, FpmlPartySelector ourPartySelector, FpmlTradeInfoParserPlugin tradeInfoParser, ReferenceData refData) { this.fpmlRoot = fpmlRootEl; this.references = ImmutableMap.copyOf(references); this.parties = parseParties(fpmlRootEl); this.ourPartyHrefIds = findOurParty(ourPartySelector); this.tradeInfoParser = tradeInfoParser; this.refData = refData; }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance of the parser, based on the specified selector. /// <para> /// The FpML parser has a number of plugin points that can be controlled: /// <ul> /// <li>the <seealso cref="FpmlPartySelector party selector"/> /// <li>the <seealso cref="FpmlTradeInfoParserPlugin trade info parser"/> /// <li>the <seealso cref="FpmlParserPlugin trade parsers"/> /// <li>the <seealso cref="ReferenceData reference data"/> /// </ul> /// This method uses the <seealso cref="FpmlTradeInfoParserPlugin#standard() standard"/> /// trade info parser, the trade parsers registered in <seealso cref="FpmlParserPlugin"/> /// configuration and the <seealso cref="ReferenceData#standard() standard"/> reference data. /// /// </para> /// </summary> /// <param name="ourPartySelector"> the selector used to find "our" party within the set of parties in the FpML document </param> /// <returns> the document parser </returns> public static FpmlDocumentParser of(FpmlPartySelector ourPartySelector) { return(of(ourPartySelector, FpmlTradeInfoParserPlugin.standard())); }
/// <summary> /// Obtains an instance of the parser, based on the specified selector and plugins. /// <para> /// The FpML parser has a number of plugin points that can be controlled: /// <ul> /// <li>the <seealso cref="FpmlPartySelector party selector"/> /// <li>the <seealso cref="FpmlTradeInfoParserPlugin trade info parser"/> /// <li>the <seealso cref="FpmlParserPlugin trade parsers"/> /// <li>the <seealso cref="ReferenceData reference data"/> /// </ul> /// /// </para> /// </summary> /// <param name="ourPartySelector"> the selector used to find "our" party within the set of parties in the FpML document </param> /// <param name="tradeInfoParser"> the trade info parser </param> /// <param name="tradeParsers"> the map of trade parsers, keyed by the FpML element name </param> /// <param name="refData"> the reference data to use </param> /// <returns> the document parser </returns> public static FpmlDocumentParser of(FpmlPartySelector ourPartySelector, FpmlTradeInfoParserPlugin tradeInfoParser, IDictionary <string, FpmlParserPlugin> tradeParsers, ReferenceData refData) { return(new FpmlDocumentParser(ourPartySelector, tradeInfoParser, tradeParsers, refData)); }
/// <summary> /// Obtains an instance of the parser, based on the specified selector and plugins. /// <para> /// The FpML parser has a number of plugin points that can be controlled: /// <ul> /// <li>the <seealso cref="FpmlPartySelector party selector"/> /// <li>the <seealso cref="FpmlTradeInfoParserPlugin trade info parser"/> /// <li>the <seealso cref="FpmlParserPlugin trade parsers"/> /// <li>the <seealso cref="ReferenceData reference data"/> /// </ul> /// This method uses the <seealso cref="ReferenceData#standard() standard"/> reference data. /// /// </para> /// </summary> /// <param name="ourPartySelector"> the selector used to find "our" party within the set of parties in the FpML document </param> /// <param name="tradeInfoParser"> the trade info parser </param> /// <param name="tradeParsers"> the map of trade parsers, keyed by the FpML element name </param> /// <returns> the document parser </returns> public static FpmlDocumentParser of(FpmlPartySelector ourPartySelector, FpmlTradeInfoParserPlugin tradeInfoParser, IDictionary <string, FpmlParserPlugin> tradeParsers) { return(of(ourPartySelector, tradeInfoParser, tradeParsers, ReferenceData.standard())); }
/// <summary> /// Obtains an instance of the parser, based on the specified selector and trade info plugin. /// <para> /// The FpML parser has a number of plugin points that can be controlled: /// <ul> /// <li>the <seealso cref="FpmlPartySelector party selector"/> /// <li>the <seealso cref="FpmlTradeInfoParserPlugin trade info parser"/> /// <li>the <seealso cref="FpmlParserPlugin trade parsers"/> /// <li>the <seealso cref="ReferenceData reference data"/> /// </ul> /// This method uses the trade parsers registered in <seealso cref="FpmlParserPlugin"/> configuration /// and the <seealso cref="ReferenceData#standard() standard"/> reference data. /// /// </para> /// </summary> /// <param name="ourPartySelector"> the selector used to find "our" party within the set of parties in the FpML document </param> /// <param name="tradeInfoParser"> the trade info parser </param> /// <returns> the document parser </returns> public static FpmlDocumentParser of(FpmlPartySelector ourPartySelector, FpmlTradeInfoParserPlugin tradeInfoParser) { return(of(ourPartySelector, tradeInfoParser, FpmlParserPlugin.extendedEnum().lookupAllNormalized())); }