/** * @param otherRecord The record to merge into this record. * @return A set of field keys which have changed, or were added. A field key incorporates any GraphQL arguments in * addition to the field name. */ public Set<String> mergeWith(Record otherRecord) { Set<String> changedKeys = new HashSet<>(); for (Map.Entry<String, Object> field : otherRecord.fields.entrySet()) { Object newFieldValue = field.getValue(); boolean hasOldFieldValue = this.fields.containsKey(field.getKey()); Object oldFieldValue = this.fields.get(field.getKey()); if (!hasOldFieldValue || (oldFieldValue == null && newFieldValue != null) || (oldFieldValue != null && !oldFieldValue.equals(newFieldValue))) { this.fields.put(field.getKey(), newFieldValue); changedKeys.add(key() + "." + field.getKey()); adjustSizeEstimate(newFieldValue, oldFieldValue); } } mutationId = otherRecord.mutationId; return changedKeys; }
/** * @param otherRecord The record to merge into this record. * @return A set of field keys which have changed, or were added. A field key incorporates any GraphQL arguments in * addition to the field name. */ public Set<String> mergeWith(Record otherRecord) { Set<String> changedKeys = new HashSet<>(); for (Map.Entry<String, Object> field : otherRecord.fields.entrySet()) { Object newFieldValue = field.getValue(); boolean hasOldFieldValue = this.fields.containsKey(field.getKey()); Object oldFieldValue = this.fields.get(field.getKey()); if (!hasOldFieldValue || (oldFieldValue == null && newFieldValue != null) || (oldFieldValue != null && !oldFieldValue.equals(newFieldValue))) { this.fields.put(field.getKey(), newFieldValue); changedKeys.add(key() + "." + field.getKey()); adjustSizeEstimate(newFieldValue, oldFieldValue); } } mutationId = otherRecord.mutationId; return changedKeys; }
/** * @param otherRecord The record to merge into this record. * @return A set of field keys which have changed, or were added. A field key incorporates any GraphQL arguments in * addition to the field name. */ public Set<String> mergeWith(Record otherRecord) { Set<String> changedKeys = new HashSet<>(); for (Map.Entry<String, Object> field : otherRecord.fields.entrySet()) { Object newFieldValue = field.getValue(); boolean hasOldFieldValue = this.fields.containsKey(field.getKey()); Object oldFieldValue = this.fields.get(field.getKey()); if (!hasOldFieldValue || (oldFieldValue == null && newFieldValue != null) || (oldFieldValue != null && !oldFieldValue.equals(newFieldValue))) { this.fields.put(field.getKey(), newFieldValue); changedKeys.add(key() + "." + field.getKey()); adjustSizeEstimate(newFieldValue, oldFieldValue); } } mutationId = otherRecord.mutationId; return changedKeys; }