CavalliumDBEngine/src/main/java/it/cavallium/dbengine/database/LLTerm.java

60 lines
1.0 KiB
Java
Raw Normal View History

2020-12-07 22:15:18 +01:00
package it.cavallium.dbengine.database;
import java.util.Objects;
2022-02-25 15:46:32 +01:00
import org.apache.lucene.index.Term;
import org.apache.lucene.util.BytesRef;
2020-12-07 22:15:18 +01:00
public class LLTerm {
private final String key;
2022-02-25 15:46:32 +01:00
private final BytesRef value;
2020-12-07 22:15:18 +01:00
public LLTerm(String key, String value) {
2022-02-25 15:46:32 +01:00
this.key = key;
this.value = new BytesRef(value);
}
public LLTerm(String key, BytesRef value) {
2020-12-07 22:15:18 +01:00
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
2022-02-25 15:46:32 +01:00
public String getValueUTF8() {
return value.utf8ToString();
}
public BytesRef getValueBytesRef() {
2020-12-07 22:15:18 +01:00
return value;
}
@Override
public String toString() {
return "LLTerm{" +
"key='" + key + '\'' +
", value='" + value + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LLTerm llTerm = (LLTerm) o;
return Objects.equals(key, llTerm.key) &&
Objects.equals(value, llTerm.value);
}
@Override
public int hashCode() {
return Objects.hash(key, value);
}
}