net.quasardb.qdb.jni.Reference Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jni Show documentation
Show all versions of jni Show documentation
API for the JNI components of the QuasarDB API for Java. Should not be included directly.
package net.quasardb.qdb.jni;
public final class Reference {
public T value;
public void clear() {
this.value = null;
}
public T get() {
assert(this.isEmpty() == false);
return this.value;
}
public static Reference of(T value) {
Reference tmp = new Reference();
tmp.value = value;
return tmp;
}
/**
* Clears reference and returns last known value.
*/
public T pop() {
T tmp = this.get();
this.clear();
assert(this.isEmpty() == true);
return tmp;
}
public void set(T value) {
this.value = value;
}
public boolean isEmpty() {
return this.value == null;
}
}