/** * {@inheritDoc} */ @Override public void putAll(ValuesStorage other) { if (other instanceof MapValuesStorage) { values.putAll(((MapValuesStorage) other).values); } else { Set<Map.Entry<String, Object>> valuesSet = other.valueSet(); for (Map.Entry<String, Object> entry : valuesSet) { put(entry.getKey(), entry.getValue(), false); } } }
/** * Sets columns and values to insert based on the contents of the {@link ValuesStorage} * * @param values a ValuesStorage where keys are column names and values are values to insert * @return this Insert object, to allow chaining method calls */ public Insert fromValues(ValuesStorage values) { List<Object> valuesToInsert = new ArrayList<>(); for (Map.Entry<String, Object> entry : values.valueSet()) { this.columns.add(entry.getKey()); valuesToInsert.add(entry.getValue()); } this.valuesToInsert.add(valuesToInsert); invalidateCompileCache(); return this; }
/** * Set the columns and values to update based on the specified model object * * @return this Update object, to allow chaining method calls */ public Update fromTemplate(AbstractModel template) { if (!template.isModified()) { throw new IllegalArgumentException("Template has no values set to use for update"); } ValuesStorage setValues = template.getSetValues(); for (Entry<String, Object> entry : setValues.valueSet()) { valuesToUpdate.put(entry.getKey(), entry.getValue()); } invalidateCompileCache(); return this; }
/** * {@inheritDoc} */ @Override public void putAll(ValuesStorage other) { if (other instanceof ContentValuesStorage) { values.putAll(((ContentValuesStorage) other).values); } else { Set<Map.Entry<String, Object>> valuesSet = other.valueSet(); for (Map.Entry<String, Object> entry : valuesSet) { put(entry.getKey(), entry.getValue(), false); } } }
/** * {@inheritDoc} */ @Override public void putAll(ValuesStorage other) { if (other instanceof MapValuesStorage) { values.putAll(((MapValuesStorage) other).values); } else { Set<Map.Entry<String, Object>> valuesSet = other.valueSet(); for (Map.Entry<String, Object> entry : valuesSet) { put(entry.getKey(), entry.getValue(), false); } } }
/** * Sets columns and values to insert based on the contents of the {@link ValuesStorage} * * @param values a ValuesStorage where keys are column names and values are values to insert * @return this Insert object, to allow chaining method calls */ public Insert fromValues(ValuesStorage values) { List<Object> valuesToInsert = new ArrayList<>(); for (Map.Entry<String, Object> entry : values.valueSet()) { this.columns.add(entry.getKey()); valuesToInsert.add(entry.getValue()); } this.valuesToInsert.add(valuesToInsert); invalidateCompileCache(); return this; }
/** * Set the columns and values to update based on the specified model object * * @return this Update object, to allow chaining method calls */ public Update fromTemplate(AbstractModel template) { if (!template.isModified()) { throw new IllegalArgumentException("Template has no values set to use for update"); } ValuesStorage setValues = template.getSetValues(); for (Entry<String, Object> entry : setValues.valueSet()) { valuesToUpdate.put(entry.getKey(), entry.getValue()); } invalidateCompileCache(); return this; }