@Test public void shouldCopyCustomTagsToComponent() throws FieldNotFound { Instrument instrument1 = new Instrument(); instrument1.set(new Symbol("EURUSD")); instrument1.set(new Product(Product.CURRENCY)); instrument1.set(new SecurityType(SecurityType.FOREIGN_EXCHANGE_CONTRACT)); instrument1.setString(12345, "ABC"); instrument1.setInt(54321, 0xCAFE); assertEquals("EURUSD", instrument1.getSymbol().getValue()); assertEquals(Product.CURRENCY, instrument1.getProduct().getValue()); assertEquals(SecurityType.FOREIGN_EXCHANGE_CONTRACT, instrument1.getSecurityType().getValue()); assertEquals("ABC", instrument1.getString(12345)); assertEquals(0xCAFE, instrument1.getInt(54321)); Instrument instrument2 = new Instrument(); instrument1.copyTo(instrument2); assertEquals("EURUSD", instrument2.getSymbol().getValue()); assertEquals(Product.CURRENCY, instrument2.getProduct().getValue()); assertEquals(SecurityType.FOREIGN_EXCHANGE_CONTRACT, instrument2.getSecurityType().getValue()); assertEquals("ABC", instrument2.getString(12345)); assertEquals(0xCAFE, instrument2.getInt(54321)); }
public void copyTo(FieldMap fields) { try { for (int componentField : this.fields.keySet()) { fields.setField(componentField, getField(componentField)); } for (int groupField : this.groups.keySet()) { fields.setField(groupField, getField(groupField)); fields.setGroups(groupField, getGroups(groupField)); } } catch (FieldNotFound e) { } }
MessageComponent extends FieldMap { public void copyTo(FieldMap fields) { try { for (int componentField : this.fields.keySet()) { fields.setField(componentField, getField(componentField)); } for (int groupField : this.groups.keySet()) { fields.setField(groupField, getField(groupField)); fields.setGroups(groupField, getGroups(groupField)); } } catch (FieldNotFound e) { } } }
MessageComponent extends FieldMap { public void copyTo(FieldMap fields) { try { for (int componentField : this.fields.keySet()) { fields.setField(componentField, getField(componentField)); } for (int groupField : this.groups.keySet()) { fields.setField(groupField, getField(groupField)); fields.setGroups(groupField, getGroups(groupField)); } } catch (FieldNotFound e) { } } protected  MessageComponent(); protected  MessageComponent(int[] fieldOrder); }
MessageComponent extends FieldMap { public void copyTo(FieldMap fields) { try { for (int componentField : this.fields.keySet()) { fields.setField(componentField, getField(componentField)); } for (int groupField : this.groups.keySet()) { fields.setField(groupField, getField(groupField)); fields.setGroups(groupField, getGroups(groupField)); } } catch (FieldNotFound e) { } } protected  MessageComponent(); protected  MessageComponent(int[] fieldOrder); void copyFrom(FieldMap fields); void copyTo(FieldMap fields); }
MessageComponent extends FieldMap { public void copyTo(FieldMap fields) { try { for (int componentField : this.fields.keySet()) { fields.setField(componentField, getField(componentField)); } for (int groupField : this.groups.keySet()) { fields.setField(groupField, getField(groupField)); fields.setGroups(groupField, getGroups(groupField)); } } catch (FieldNotFound e) { } } protected  MessageComponent(); protected  MessageComponent(int[] fieldOrder); void copyFrom(FieldMap fields); void copyTo(FieldMap fields);  }