org.marketcetera.orderloader.system
Class InstrumentFromRow

java.lang.Object
  extended by org.marketcetera.core.instruments.DynamicInstrumentHandler<Row>
      extended by org.marketcetera.orderloader.system.InstrumentFromRow
Direct Known Subclasses:
EquityFromRow, OptionFromRow

public abstract class InstrumentFromRow
extends DynamicInstrumentHandler<Row>

Abstracts out creation of an instrument from a row of fields.

Since:
2.0.0
Version:
$Id: InstrumentFromRow.java 16154 2012-07-14 16:34:05Z colin $
Author:
anshul@marketcetera.com

Field Summary
static String FIELD_SECURITY_TYPE
          The Security Type field header name.
static String FIELD_SYMBOL
          The Symbol field header name.
 
Constructor Summary
InstrumentFromRow()
           
 
Method Summary
protected abstract  boolean canProcess(String inHeader, int inIndex)
          Returns true if this handler can handle the field corresponding to the supplied header.
protected abstract  Instrument extract(Row inRow)
          Extracts the instrument value from the supplied row.
protected  SecurityType getSecurityType(String[] inRow)
          Returns the security type value from the supplied row, if available.
protected  String getSymbol(String[] inRow)
          Returns the symbol value for the supplied row.
 
Methods inherited from class org.marketcetera.core.instruments.DynamicInstrumentHandler
isHandled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD_SYMBOL

public static final String FIELD_SYMBOL
The Symbol field header name.

See Also:
Constant Field Values

FIELD_SECURITY_TYPE

public static final String FIELD_SECURITY_TYPE
The Security Type field header name.

See Also:
Constant Field Values
Constructor Detail

InstrumentFromRow

public InstrumentFromRow()
Method Detail

canProcess

protected abstract boolean canProcess(String inHeader,
                                      int inIndex)
Returns true if this handler can handle the field corresponding to the supplied header.

Subclasses override this method to setup any state needed to handle the headers that they care about.

Parameters:
inHeader - the header value.
inIndex - the header index.
Returns:
if the handler can process the field, false otherwise.

getSymbol

protected final String getSymbol(String[] inRow)
Returns the symbol value for the supplied row.

Parameters:
inRow - the row
Returns:
the symbol value.

getSecurityType

protected final SecurityType getSecurityType(String[] inRow)
                                      throws OrderParsingException
Returns the security type value from the supplied row, if available.

Parameters:
inRow - the row
Returns:
the security type value.
Throws:
OrderParsingException - if there were errors parsing the security type value.

extract

protected abstract Instrument extract(Row inRow)
                               throws OrderParsingException
Extracts the instrument value from the supplied row.

Parameters:
inRow - the row
Returns:
the extracted Instrument value.
Throws:
OrderParsingException - if there were errors extracting the instrument value.


Copyright © 2012. All Rights Reserved.