Short answer: getString(int field)
is actually the generic method you're looking for. You can call it on any field that is present. Because when you think about it, a FIX message is just a bunch of fields serialized to strings and concatenated, right?
Longer answer: FIX messages, internally, just store the fields as strings. When you store a field to a Message, it doesn't keep your Field object references; it just stores it as a string again. Similarly, when a message is received, it doesn't allocate a bunch of new Field objects... that's a waste of time and memory. The field objects are created on-demand when you query for them, and non-string fields are converted when you query for them.
When you call getInt()
, what actually happens is that the method extracts the field's string value and converts it to an int then returns it. Similarly, for getField(IntField)
, it extracts the string, converts it to int, then constructs a new IntField and returns that.
All fields are sent to you from the counterparty as a string. Thus, getString(int field)
is perfectly generic, and gives you all the information about the field that there is.