@Override public Set<Field<?>> getFields() { Set<Field<?>> fields = super.getFields(); fields.add(new BaseField<BigDecimal>(getEventId(), Field.Name.HIGH.field(), high)); fields.add(new BaseField<BigDecimal>(getEventId(), Field.Name.LOW.field(), low)); fields.add(new BaseField<BigDecimal>(getEventId(), Field.Name.OPEN.field(), open)); fields.add(new BaseField<BigDecimal>(getEventId(), Field.Name.CLOSE.field(), close)); fields.add(new BaseField<Integer>(getEventId(), Field.Name.VOLUME.field(), volume)); fields.add(new BaseField<String>(getEventId(), Field.Name.INTERVAL.field(), interval)); return fields; }
public Bar(Set<Field<?>> fields) { super(fields); for (Field<?> f : fields) { if (f.getName().equalsIgnoreCase(Field.Name.VOLUME.field())) this.volume = (Integer) f.getValue(); if (f.getName().equalsIgnoreCase(Field.Name.HIGH.field())) this.high = (BigDecimal) f.getValue(); if (f.getName().equalsIgnoreCase(Field.Name.LOW.field())) this.low = (BigDecimal) f.getValue(); if (f.getName().equalsIgnoreCase(Field.Name.OPEN.field())) this.open = (BigDecimal) f.getValue(); if (f.getName().equalsIgnoreCase(Field.Name.CLOSE.field())) this.close = (BigDecimal) f.getValue(); if (f.getName().equalsIgnoreCase(Field.Name.INTERVAL.field())) this.interval = (String) f.getValue(); } }