public void setValue(RecT rec, ValueT value) throws SQLException { doSetValue(rec, value); Flow<ValueT> f = rec.getFlow(this); if (f != null) { f.setValue(value); } }
public Flow<ValueT> valueFlow(final RecT rec) { Flow<ValueT> f = rec.getFlow(this); if (f == null) { f = new Flow<ValueT>() { @Override public void setValue(ValueT value, Set<Node> blacklist) { try { Map<Col<RecT, ?>, Object> valueMap = new HashMap<>(); for (Col<RecT, ?> c : table.cols()) { if (c != Col.this) { valueMap.put(c, c.getValue(rec)); } } Col.this.setValue(rec, value); for (Map.Entry<Col<RecT, ?>, Object> e : valueMap.entrySet()) { Col<RecT, ?> c = e.getKey(); Flow<?> f = rec.getFlow(c); if (f != null && !c.equalObjects(valueMap.get(c), c.getValue(rec))) { f.pushValue(); } } } catch (SQLException e) { throw new RuntimeException(e); } } @Override public ValueT value() { try { return getValue(rec); } catch (SQLException e) { throw new RuntimeException(e); } } }; rec.addFlow(this, f); } return f; }
public void updateValueFlow(RecT rec) { Flow<ValueT> f = rec.getFlow(this); if (f != null) { f.pushValue(); } }