Convert anonymous class to static class
This commit is contained in:
parent
2c11b13b7a
commit
79a6c3140f
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user