public Map<String, Object> getValuesToCache() { Map<String, Object> toPut = new HashMap<>(); for (Map.Entry<FieldComponent, PendingSlot<ColumnView>> column : columnMap.entrySet()) { ColumnView value; try { value = column.getValue().get(); } catch (IllegalStateException e) { throw new IllegalStateException(column.getKey().toString(), e); } toPut.put(fieldCacheKey(column.getKey()), value); } for (Map.Entry<ForeignKeyId, PendingSlot<ForeignKey>> fk : foreignKeyMap.entrySet()) { toPut.put(fkCacheKey(fk.getKey()), fk.getValue().get()); } if(!columnMap.isEmpty()) { toPut.put(rowCountKey(), rowCountFromColumn(columnMap)); } else if(rowCount != null) { toPut.put(rowCountKey(), rowCount.get()); } return toPut; }