co.easimart.EasimartSetOperation Maven / Gradle / Ivy
package co.easimart;
/**
* An operation where a field is set to a given value regardless of its previous value.
*/
/** package */ class EasimartSetOperation implements EasimartFieldOperation {
private final Object value;
public EasimartSetOperation(Object newValue) {
value = newValue;
}
public Object getValue() {
return value;
}
@Override
public Object encode(EasimartEncoder objectEncoder) {
return objectEncoder.encode(value);
}
@Override
public EasimartFieldOperation mergeWithPrevious(EasimartFieldOperation previous) {
return this;
}
@Override
public Object apply(Object oldValue, String key) {
return value;
}
}