package org.ehcache.clustered.common.internal.store.operations;
import org.ehcache.spi.serialization.Serializer;
import java.nio.ByteBuffer;
public class ReplaceOperation<K, V> extends BaseKeyValueOperation<K, V> implements Result<K, V> {
public ReplaceOperation(final K key, final V value, final long timeStamp) {
super(key, value, timeStamp);
}
ReplaceOperation(final ByteBuffer buffer, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) {
super(buffer, keySerializer, valueSerializer);
}
@Override
public OperationCode getOpCode() {
return OperationCode.REPLACE;
}
@Override
public Result<K, V> apply(final Result<K, V> previousOperation) {
if(previousOperation == null) {
return null;
} else {
return this;
}
}
@Override
public PutOperation<K, V> asOperationExpiringAt(long expirationTime) {
return new PutOperation<>(this, -expirationTime);
}
}