fix: ref opt native fns should be instance methods
This commit is contained in:
@@ -10,7 +10,7 @@ public class Option implements dev.toad.msg.Option, AutoCloseable {
|
||||
Ptr ptr;
|
||||
final long number;
|
||||
|
||||
native dev.toad.msg.ref.OptionValue[] values(long ptr);
|
||||
public native dev.toad.msg.ref.OptionValue[] valueRefs();
|
||||
|
||||
Option(long addr, long number) {
|
||||
this.ptr = Ptr.register(this.getClass(), addr);
|
||||
@@ -21,12 +21,8 @@ public class Option implements dev.toad.msg.Option, AutoCloseable {
|
||||
return this.number;
|
||||
}
|
||||
|
||||
public dev.toad.msg.ref.OptionValue[] valueRefs() {
|
||||
return this.values(this.ptr.addr());
|
||||
}
|
||||
|
||||
public List<dev.toad.msg.OptionValue> values() {
|
||||
return Arrays.asList(this.values(this.ptr.addr()));
|
||||
return Arrays.asList(this.valueRefs());
|
||||
}
|
||||
|
||||
public dev.toad.msg.owned.Option toOwned() {
|
||||
|
||||
@@ -5,20 +5,16 @@ import dev.toad.ffi.Ptr;
|
||||
public final class OptionValue
|
||||
implements dev.toad.msg.OptionValue, AutoCloseable {
|
||||
|
||||
private final Ptr ptr;
|
||||
final Ptr ptr;
|
||||
|
||||
private native byte[] bytes(long addr);
|
||||
public native byte[] asBytes();
|
||||
|
||||
OptionValue(long addr) {
|
||||
this.ptr = Ptr.register(this.getClass(), addr);
|
||||
}
|
||||
|
||||
public byte[] asBytes() {
|
||||
return this.bytes(this.ptr.addr());
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return new String(this.bytes(this.ptr.addr()));
|
||||
return new String(this.asBytes());
|
||||
}
|
||||
|
||||
public dev.toad.msg.owned.OptionValue toOwned() {
|
||||
|
||||
Reference in New Issue
Block a user