public DecimalField getField(DecimalField field) throws FieldNotFound { return updateValue(field, getDecimal(field.getField())); }
public void removeGroup(int num, int field) { final List<Group> groupList = getGroups(field); if (num <= groupList.size()) { groupList.remove(num - 1); } if (!groupList.isEmpty()) { setGroupCount(field, groupList.size()); } }
public IntField getField(IntField field) throws FieldNotFound { return updateValue(field, getInt(field.getField())); }
private static String getFieldOrDefault(FieldMap fields, int tag, String defaultValue) { if (fields.isSetField(tag)) { try { return fields.getString(tag); } catch (final FieldNotFound e) { // ignore, should never happen return null; } } else { return defaultValue; } }
/** * Returns the strike price value for the specified FIX message. * * @param inMessage the FIX message. * * @return the strike price value, if available, null otherwise. */ private static BigDecimal getStrikePrice(FieldMap inMessage) { if (inMessage.isSetField(StrikePrice.FIELD)) { try { return inMessage.getDecimal(StrikePrice.FIELD); } catch (FieldNotFound ignore) { } } return null; } /**
public void removeGroup(int field) { getGroups(field).clear(); removeField(field); }
protected void calculateString(StringBuilder buffer, int[] preFields, int[] postFields) { if (preFields != null) { for (int preField : preFields) { appendField(buffer, getField(preField, null)); if (!isOrderedField(tag, preFields) && !isOrderedField(tag, postFields) && !isGroupField(tag)) { appendField(buffer, field); } else if (isGroupField(tag) && isOrderedField(tag, fieldOrder) && getGroupCount(tag) > 0) { appendField(buffer, field); for (Group group : getGroups(tag)) { group.calculateString(buffer, preFields, postFields); if (!isOrderedField(groupCountTag, fieldOrder)) { final List<Group> groups = entry.getValue(); int groupCount = groups.size(); if (groupCount > 0) { final IntField countField = new IntField(groupCountTag.intValue(), groupCount); appendField(buffer, countField); for (Group group : groups) { group.calculateString(buffer, preFields, postFields); appendField(buffer, getField(postField, null));
public LocalDateTime getUtcTimeStamp(int field) throws FieldNotFound { try { return UtcTimestampConverter.convertToLocalDateTime(getString(field)); } catch (final FieldConvertError e) { throw newIncorrectDataException(e, field); } }
final Element fields = document.createElement(section); message.appendChild(fields); final Iterator<Field<?>> fieldItr = fieldMap.iterator(); while (fieldItr.hasNext()) { final Field<?> field = fieldItr.next(); fields.appendChild(fieldElement); final Iterator<Integer> groupKeyItr = fieldMap.groupKeyIterator(); while (groupKeyItr.hasNext()) { final int groupKey = groupKeyItr.next(); final List<Group> groups = fieldMap.getGroups(groupKey); for (Group group : groups) { toXMLFields(groupsElement, "group", group, dataDictionary);
FieldType fieldType = inDataDictionary.getFieldType(inFieldId); if(fieldType == null){ value = inFieldMap.getString(inFieldId); } else if (inHumanReadable && inDataDictionary.hasFieldValue(inFieldId)) { value = inFieldMap.getString(inFieldId); try { value = FIXDataDictionary.getHumanFieldValue(inDataDictionary, inFieldId, inFieldMap.getString(inFieldId)); } catch (Exception ignored) { value = inFieldMap.getUtcTimeOnly(inFieldId); //i18n_time } else if(fieldType.equals(FieldType.UTCTIMESTAMP)){ value = new DateTime(inFieldMap.getUtcTimeStamp(inFieldId)); } else if(fieldType.equals(FieldType.UTCDATEONLY) ||fieldType.equals(FieldType.UTCDATE)){ value = inFieldMap.getUtcDateOnly(inFieldId); } else if(Number.class.isAssignableFrom(fieldType.getJavaType())){ value = inFieldMap.getDecimal(inFieldId); } else if (inFieldId == ClOrdID.FIELD) { value = new NumericStringSortable(inFieldMap.getString(inFieldId)); } else { value = inFieldMap.getString(inFieldId);
public void copyFrom(FieldMap fields) { try { for (int componentField : getFields()) { if (fields.isSetField(componentField)) { setField(componentField, fields.getField(componentField)); } } for (int groupField : getGroupFields()) { if (fields.isSetField(groupField)) { setField(groupField, fields.getField(groupField)); setGroups(groupField, fields.getGroups(groupField)); } } } catch (FieldNotFound e) { // should not happen } }
/** * Warning! This method does not handle groups. * @param copyTo * @param copyFrom */ public static void copyFields(FieldMap copyTo, FieldMap copyFrom) { Iterator<Field<?>> iter = copyFrom.iterator(); while (iter.hasNext()){ Field<?> field = iter.next(); try { copyTo.setField(copyFrom.getField(new StringField(field.getTag()))); } catch (FieldNotFound e) { // do nothing } } }
private void iterate(FieldMap map, String msgType, DataDictionary dd) throws IncorrectTagValue, IncorrectDataFormat { final Iterator<Field<?>> iterator = map.iterator(); while (iterator.hasNext()) { final StringField field = (StringField) iterator.next(); checkHasValue(field); if (hasVersion) { checkValidFormat(field); checkValue(field); } if (beginString != null) { dd.checkField(field, msgType, map instanceof Message); dd.checkGroupCount(field, map, msgType); } } for (final List<Group> groups : map.getGroups().values()) { for (final Group group : groups) { iterate(group, msgType, dd.getGroup(msgType, group.getFieldTag()) .getDataDictionary()); } } }
if (inMessage.isSetField(quickfix.field.PutOrCall.FIELD)) { try { return OptionType.getInstanceForFIXValue( inMessage.getInt( quickfix.field.PutOrCall.FIELD)); } catch (FieldNotFound ignore) { if(inMessage.isSetField(CFICode.FIELD)) { try { return CFICodeUtils.getOptionType( inMessage.getString(CFICode.FIELD)); } catch (FieldNotFound ignore) {
public static void insertFieldIfMissing(int fieldNumber, String value, FieldMap fieldMap) throws CoreException { if (fieldMap.isSetField(fieldNumber)){ StringField testField = new StringField(fieldNumber); try { fieldMap.getField(testField); if(testField.getValue().equals(value)){ return; } } catch (FieldNotFound ignored) { //Unexpected as isSetField() returned true //Don't do anything so that we set the field before we return. } } fieldMap.setField(new StringField(fieldNumber, value)); }
/** * Returns the number of groups associated with the specified count tag. * * @param tag the count tag number * @return the number of times the group repeats */ public int getGroupCount(int tag) { return getGroups(tag).size(); }
protected void setGroupCount(int countTag, int groupSize) { try { StringField count; if (groupSize == 1) { count = new StringField(countTag, "1"); setField(countTag, count); } else { count = getField(countTag); } count.setValue(Integer.toString(groupSize)); } catch (final FieldNotFound e) { // Shouldn't happen throw new RuntimeError(e); } }
public UtcDateOnlyField getField(UtcDateOnlyField field) throws FieldNotFound { return updateValue(field, getUtcDateOnly(field.getField())); }
public UtcTimeOnlyField getField(UtcTimeOnlyField field) throws FieldNotFound { return updateValue(field, getUtcTimeOnly(field.getField())); }