Package com.opengamma.strata.loader.csv
Interface TradeCsvParserPlugin
-
- All Superinterfaces:
Named
- All Known Implementing Classes:
FxNdfTradeCsvPlugin
,FxSingleBarrierOptionTradeCsvPlugin
,IborCapFloorTradeCsvPlugin
,SecurityTradeCsvPlugin
public interface TradeCsvParserPlugin extends Named
Pluggable CSV trade parser.Implementations of this interface parse a CSV file.
See
TradeCsvLoader
for the main entry point to parsing.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static ExtendedEnum<TradeCsvParserPlugin>
extendedEnum()
Gets the extended enum helper.String
getName()
Gets the name that uniquely identifies this parser.default boolean
isAdditionalRow(CsvRow baseRow, CsvRow additionalRow)
Checks if there is an additional row that must be parsed alongside the base row.static TradeCsvParserPlugin
of(String uniqueName)
Obtains an instance from the specified unique name.Optional<Trade>
parseTrade(Class<?> requiredJavaType, CsvRow baseRow, List<CsvRow> additionalRows, TradeInfo info, TradeCsvInfoResolver resolver)
Parses a single CSV format trade from the input.Set<String>
tradeTypeNames()
Returns the upper-case product type names that this plugin supports.
-
-
-
Method Detail
-
of
static TradeCsvParserPlugin of(String uniqueName)
Obtains an instance from the specified unique name.- Parameters:
uniqueName
- the unique name- Returns:
- the parser
- Throws:
IllegalArgumentException
- if the name is not known
-
extendedEnum
static ExtendedEnum<TradeCsvParserPlugin> extendedEnum()
Gets the extended enum helper.This helper allows instances of the parser to be looked up. It also provides the complete set of available instances.
- Returns:
- the extended enum helper
-
tradeTypeNames
Set<String> tradeTypeNames()
Returns the upper-case product type names that this plugin supports.These are matched against the CSV file type column.
- Returns:
- the types that this plugin supports
-
isAdditionalRow
default boolean isAdditionalRow(CsvRow baseRow, CsvRow additionalRow)
Checks if there is an additional row that must be parsed alongside the base row.An example use for this is parsing variable notional swaps.
- Parameters:
baseRow
- the base rowadditionalRow
- the additional row- Returns:
- true if the base row and additional row must be parsed together
-
parseTrade
Optional<Trade> parseTrade(Class<?> requiredJavaType, CsvRow baseRow, List<CsvRow> additionalRows, TradeInfo info, TradeCsvInfoResolver resolver)
Parses 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
- 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
- Throws:
RuntimeException
- if unable to parse
-
getName
String getName()
Gets the name that uniquely identifies this parser.The name should typically be the name of the
Product
that can be parsed. For example, 'Fra', 'Swap' or 'FxSingle'.This name is used in serialization and can be parsed using
of(String)
.
-
-