/** * Extracted method to ensure generic type safety. */ final <T> void addValue(StoreQuery<?> store, Field<T> field) { addValue(store, field, get(field)); }
/** * Set all changed values of this record to a store query */ final void addChangedValues(Field<?>[] storeFields, StoreQuery<R> query) { Fields<Record> f = new Fields<Record>(storeFields); for (Field<?> field : fields.fields.fields) { if (changed(field) && f.field(field) != null) { addValue(query, field); } } }
/** * Set an updated version value to a store query */ final BigInteger addRecordVersion(StoreQuery<?> store) { BigInteger result = null; if (isTimestampOrVersionAvailable()) { TableField<R, ?> version = getTable().getRecordVersion(); if (version != null) { Object value = get(version); // Use BigInteger locally to avoid arithmetic overflows if (value == null) { result = BigInteger.ONE; } else { result = new BigInteger(value.toString()).add(BigInteger.ONE); } addValue(store, version, result); } } return result; }
/** * Set an updated timestamp value to a store query */ final Timestamp addRecordTimestamp(StoreQuery<?> store) { Timestamp result = null; if (isTimestampOrVersionAvailable()) { TableField<R, ?> timestamp = getTable().getRecordTimestamp(); if (timestamp != null) { // Use Timestamp locally, to provide maximum precision result = new Timestamp(configuration().clock().millis()); addValue(store, timestamp, result); } } return result; }