Package com.opengamma.strata.loader.csv
Class SecurityTradeCsvPlugin
- java.lang.Object
-
- com.opengamma.strata.loader.csv.SecurityTradeCsvPlugin
-
- All Implemented Interfaces:
Named,TradeCsvParserPlugin,TradeCsvWriterPlugin<SecurityQuantityTrade>
public class SecurityTradeCsvPlugin extends Object implements TradeCsvParserPlugin, TradeCsvWriterPlugin<SecurityQuantityTrade>
Handles the CSV file format for Security trades.
-
-
Field Summary
Fields Modifier and Type Field Description static SecurityTradeCsvPluginINSTANCEThe singleton instance of the plugin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()Gets the name that uniquely identifies this parser.Set<String>headers(List<SecurityQuantityTrade> trades)Returns the set of headers needed for this type of trade.Optional<Trade>parseTrade(Class<?> requiredJavaType, CsvRow baseRow, List<CsvRow> additionalRows, TradeInfo info, TradeCsvInfoResolver resolver)Parses a single CSV format trade from the input.Set<Class<?>>supportedTradeTypes()Provides the supported trade types for this plugin.Set<String>tradeTypeNames()Returns the upper-case product type names that this plugin supports.voidwriteCsv(CsvOutput.CsvRowOutputWithHeaders csv, SecurityQuantityTrade trade)Writes the CSV for the specified trade.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.loader.csv.TradeCsvParserPlugin
isAdditionalRow
-
-
-
-
Field Detail
-
INSTANCE
public static final SecurityTradeCsvPlugin INSTANCE
The singleton instance of the plugin.
-
-
Method Detail
-
tradeTypeNames
public Set<String> tradeTypeNames()
Description copied from interface:TradeCsvParserPluginReturns the upper-case product type names that this plugin supports.These are matched against the CSV file type column.
- Specified by:
tradeTypeNamesin interfaceTradeCsvParserPlugin- Returns:
- the types that this plugin supports
-
parseTrade
public Optional<Trade> parseTrade(Class<?> requiredJavaType, CsvRow baseRow, List<CsvRow> additionalRows, TradeInfo info, TradeCsvInfoResolver resolver)
Description copied from interface:TradeCsvParserPluginParses a single CSV format trade from the input.This parses a single trade from the CSV rows provided. The trade may exist on multiple rows
- Specified by:
parseTradein interfaceTradeCsvParserPlugin- Parameters:
requiredJavaType- the Java type to returnbaseRow- the base row to parseadditionalRows- the additional rows to parse, may be emptyinfo- the trade inforesolver- the resolver- Returns:
- the trade object, empty if choosing not to parse because the Java type does not match
-
headers
public Set<String> headers(List<SecurityQuantityTrade> trades)
Description copied from interface:TradeCsvWriterPluginReturns the set of headers needed for this type of trade.The headers are ordered and all distinct.
- Specified by:
headersin interfaceTradeCsvWriterPlugin<SecurityQuantityTrade>- Parameters:
trades- the trades to output- Returns:
- the set of additional headers
-
writeCsv
public void writeCsv(CsvOutput.CsvRowOutputWithHeaders csv, SecurityQuantityTrade trade)
Description copied from interface:TradeCsvWriterPluginWrites the CSV for the specified trade.- Specified by:
writeCsvin interfaceTradeCsvWriterPlugin<SecurityQuantityTrade>- Parameters:
csv- the CSV to write totrade- the trade to output
-
getName
public String getName()
Description copied from interface:TradeCsvParserPluginGets the name that uniquely identifies this parser.The name should typically be the name of the
Productthat can be parsed. For example, 'Fra', 'Swap' or 'FxSingle'.This name is used in serialization and can be parsed using
TradeCsvParserPlugin.of(String).- Specified by:
getNamein interfaceNamed- Specified by:
getNamein interfaceTradeCsvParserPlugin- Specified by:
getNamein interfaceTradeCsvWriterPlugin<SecurityQuantityTrade>- Returns:
- the unique name
-
supportedTradeTypes
public Set<Class<?>> supportedTradeTypes()
Description copied from interface:TradeCsvWriterPluginProvides the supported trade types for this plugin.The set typically contains the names of the
Tradethat can be written. For example, 'FraTrade', 'SwapTrade'.- Specified by:
supportedTradeTypesin interfaceTradeCsvWriterPlugin<SecurityQuantityTrade>- Returns:
- the set of supported trade types.
-
-