org.marketcetera.client.instruments
Class OptionValidationHandler

java.lang.Object
  extended by org.marketcetera.core.instruments.InstrumentFunctionHandler<I>
      extended by org.marketcetera.client.instruments.InstrumentValidationHandler<Option>
          extended by org.marketcetera.client.instruments.OptionValidationHandler

public class OptionValidationHandler
extends InstrumentValidationHandler<Option>

Validates option instruments.

The option expiry date is validated by validateExpiry(String).

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

Field Summary
 
Fields inherited from class org.marketcetera.client.instruments.InstrumentValidationHandler
SELECTOR
 
Constructor Summary
OptionValidationHandler()
          Creates an instance.
 
Method Summary
 void validate(Instrument instrument)
          Validates the supplied instrument.
static void validateExpiry(String inExpiry)
          Validates expiry field of an instrument.
static void validateExpiryDate(String inExpiry)
          Validates that the date matches the expected pattern per validateExpiry(String) and is a correct date for the given month, year and day/week combination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionValidationHandler

public OptionValidationHandler()
Creates an instance.

Method Detail

validate

public void validate(Instrument instrument)
              throws OrderValidationException
Description copied from class: InstrumentValidationHandler
Validates the supplied instrument.

Specified by:
validate in class InstrumentValidationHandler<Option>
Parameters:
instrument - the instrument
Throws:
OrderValidationException - if the validation fails.

validateExpiry

public static void validateExpiry(String inExpiry)
                           throws OrderValidationException
Validates expiry field of an instrument.

Verifies that the expiry field has either of the following formats

where:

Parameters:
inExpiry - the expiry field of the option
Throws:
OrderValidationException - if the expiry field failed validation.

validateExpiryDate

public static void validateExpiryDate(String inExpiry)
                               throws OrderValidationException
Validates that the date matches the expected pattern per validateExpiry(String) and is a correct date for the given month, year and day/week combination.

Note that this method is only available for convenience for UI validation. This method is not invoked for validation when the client is sending orders.

Parameters:
inExpiry - the expiry field of the option
Throws:
OrderValidationException - if the expiry field failed validation.


Copyright © 2012. All Rights Reserved.