FIXAntennaJava
2.26.0
|
A message can be created in two different ways:
To create a framework for a FIX application-level message, use the FIXFieldList constructor. Thereafter you can set the desired field values of a message and send it to the counter-party. In general FIXFieldList is just a List <FIXField> so it contains all the methods from java.util.List plus a few convenient methods to manipulate tags and groups of tags.
For example:
To parse a string containing a raw FIX message into the FIXMessage class, use the RawFIXUtil.getFIXFieldList(byte[]) method.
For example:
To get a FIX field value, use the FIXFieldList.getTagValueAsXXX(int tag) methods. For example, if you need a string value please use FIXFieldList.getTagValueAsString(int tag), if you need int - FIXFieldList.getTagValueAsInt(int tag), etc. Please pay attention that FIXFieldList.getTagValueAsString(int tag) and FIXFieldList.getTagValueAsBytes(int tag) return a null if this tag is not present in message. The rest methods for accessing value as primitive type throw an FieldNotFoundException if there is no such tag.
To add a field to message please use a set of FIXFieldList.addTag() methods with different parameters.
To change a field value please use FIXFieldList.set() methods:
Note: the tag will be added to the message if such tag is absent.
To remove a field by tag, use the FIXFieldList.removeTag(int tag) method. This method returns "true" if the given tag is found and the field is removed. Otherwise the method returns "false".
To get a value from repeating group use FIXFieldList.getTagValueAsXXX(int tag, int occurrence) Example:
another more convenient option is to use FIXFieldList.split(int leadingTagNumber)
User Defined Fields (tag numbers from 5000 to 9999) are handled like ordinary fields.
For example:
To clone a FIX message, use the FIXFieldList.clone() method.