public class FXSubjectParser extends AbstractSubjectParser<FXSubjectInfo>
Parses the client's request to stream a rate into an object with convenience methods to obtain the information from the request.
Example client request: /FX/GBPUSD/SPOT/GBP/0/T1
Information: FX static prefix GBPUSD currency pair (base term) SPOT tenor GBP dealt currency (can be either base or term) 0 volume band identifier T1 margin band identifier
subjectPattern
Constructor and Description |
---|
FXSubjectParser()
Constructs the FXSubjectParser using the default "subject prefix",
which is "FX".
|
FXSubjectParser(String extraSubjectPrefix)
Constructs the FXSubjectParser using an additional prefix to the default.
|
Modifier and Type | Method and Description |
---|---|
protected FXSubjectInfo |
createSubjectInfo(String subject,
String subjectPrefix,
String baseCurrency,
String termCurrency,
String amountIn,
String tenor,
String amount,
String marginBand)
Creates an instance of the subclass of
AbstractSubjectInfo that this class has been genericised with. |
com.caplin.datasource.namespace.Namespace |
getNamespace()
Returns the namespace handled by the subject parser.
|
void |
validate(FXSubjectInfo subjectInfo)
A method called by
AbstractSubjectParser.parse(String) which contains shared validation logic applicable to all sub-classes
of AbstractSubjectParser. |
getSubjectRegex, parse
public FXSubjectParser()
public FXSubjectParser(String extraSubjectPrefix)
extraSubjectPrefix
- An additional string to be appended to the default
prefix.protected FXSubjectInfo createSubjectInfo(String subject, String subjectPrefix, String baseCurrency, String termCurrency, String amountIn, String tenor, String amount, String marginBand)
AbstractSubjectParser
AbstractSubjectInfo
that this class has been genericised with.createSubjectInfo
in class AbstractSubjectParser<FXSubjectInfo>
subject
- The full subject.subjectPrefix
- A string prefix, e.g "/FX".baseCurrency
- The first currency in the pair.termCurrency
- The second currency in the pair.amountIn
- The unit that the amount is specified in. This could be the dealt currency for an instance
of FXSubjectInfo
or a unit such as OZT or Kilos for MetalSubjectInfo
,
for example.tenor
- The tenor for the subject info.amount
- The amount for the subject info, specified in the unit defined by the amountIn
parameter.marginBand
- The margin band for the subject info, sometimes referred to as the price tier.AbstractSubjectInfo
that this class has been genericised with.public void validate(FXSubjectInfo subjectInfo) throws SubjectParserException
AbstractSubjectParser
AbstractSubjectParser.parse(String)
which contains shared validation logic applicable to all sub-classes
of AbstractSubjectParser.validate
in class AbstractSubjectParser<FXSubjectInfo>
subjectInfo
- The domain object representing the subscription request.SubjectParserException
- If the values on the subscription request are invalid, for example the base
currency and term currency are the same.public com.caplin.datasource.namespace.Namespace getNamespace()
SubjectParser
Copyright © 2015 Caplin Systems.