diff --git a/src/main/java/it/cavallium/dbengine/database/LLUtils.java b/src/main/java/it/cavallium/dbengine/database/LLUtils.java index 6bfbf02..71a72ef 100644 --- a/src/main/java/it/cavallium/dbengine/database/LLUtils.java +++ b/src/main/java/it/cavallium/dbengine/database/LLUtils.java @@ -155,13 +155,7 @@ public class LLUtils { } public static Term toTerm(LLTerm term) { - var valueRef = new BytesRefBuilder() { - @Override - public BytesRef toBytesRef() { - byte[] data = term.getValue().getBytes(StandardCharsets.UTF_8); - return new BytesRef(data, 0, data.length); - } - }; + var valueRef = new FakeBytesRefBuilder(term); return new Term(term.getKey(), valueRef); } @@ -1052,4 +1046,19 @@ public class LLUtils { }); } } + + private static class FakeBytesRefBuilder extends BytesRefBuilder { + + private final LLTerm term; + + public FakeBytesRefBuilder(LLTerm term) { + this.term = term; + } + + @Override + public BytesRef toBytesRef() { + byte[] data = term.getValue().getBytes(StandardCharsets.UTF_8); + return new BytesRef(data, 0, data.length); + } + } }