![JAR search and dependency download from the Maven repository](/logo.png)
org.jsimpledb.kv.simple.Put Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsimpledb-kv-simple Show documentation
Show all versions of jsimpledb-kv-simple Show documentation
A couple of simplistic JSimpleDB key/value store implementations.
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package org.jsimpledb.kv.simple;
import com.google.common.base.Preconditions;
import org.jsimpledb.kv.KVStore;
import org.jsimpledb.kv.util.KeyWatchTracker;
/**
* Represents the addition or changing of a key/value pair in a {@link SimpleKVTransaction}.
*
*
* Note the definition of {@linkplain #equals equality} does not include the {@linkplain #getValue value}.
*/
class Put extends Mutation {
private final byte[] value;
Put(byte[] key, byte[] value) {
super(key);
Preconditions.checkArgument(value != null, "null value");
this.value = value.clone();
}
public byte[] getKey() {
return this.getMin();
}
public byte[] getValue() {
return this.value.clone();
}
@Override
public void apply(KVStore kv) {
kv.put(this.getKey(), this.getValue());
}
@Override
public boolean trigger(KeyWatchTracker keyWatchTracker) {
return keyWatchTracker.trigger(this.getKey());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy