Properly set CVec_u8Z to a byte[] which adds a ton more fn's
[ldk-java] / src / main / java / org / ldk / structs / ChannelReestablish.java
index 172ccd0ed63b4f465f806539fe34384eb4a268ef..3d47cc18364f72136b84298f1d292f0d25eaa9ee 100644 (file)
@@ -7,47 +7,56 @@ public class ChannelReestablish extends CommonBase {
        ChannelReestablish(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelReestablish_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelReestablish_free(ptr);
        }
 
        public ChannelReestablish(ChannelReestablish orig) {
-               super(bindings.ChannelReestablish_clone(orig.ptr & ~1));
+               super(bindings.ChannelReestablish_clone(orig == null ? 0 : orig.ptr & ~1));
                this.ptrs_to.add(orig);
        }
 
        public byte[] get_channel_id(ChannelReestablish this_ptr) {
-               byte[] ret = bindings.ChannelReestablish_get_channel_id(this_ptr.ptr & ~1);
+               byte[] ret = bindings.ChannelReestablish_get_channel_id(this_ptr == null ? 0 : this_ptr.ptr & ~1);
                this.ptrs_to.add(this_ptr);
                return ret;
        }
 
        public void set_channel_id(ChannelReestablish this_ptr, byte[] val) {
-               bindings.ChannelReestablish_set_channel_id(this_ptr.ptr & ~1, val);
+               bindings.ChannelReestablish_set_channel_id(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
                this.ptrs_to.add(this_ptr);
        }
 
        public long get_next_local_commitment_number(ChannelReestablish this_ptr) {
-               long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this_ptr.ptr & ~1);
+               long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this_ptr == null ? 0 : this_ptr.ptr & ~1);
                this.ptrs_to.add(this_ptr);
                return ret;
        }
 
        public void set_next_local_commitment_number(ChannelReestablish this_ptr, long val) {
-               bindings.ChannelReestablish_set_next_local_commitment_number(this_ptr.ptr & ~1, val);
+               bindings.ChannelReestablish_set_next_local_commitment_number(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
                this.ptrs_to.add(this_ptr);
        }
 
        public long get_next_remote_commitment_number(ChannelReestablish this_ptr) {
-               long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this_ptr.ptr & ~1);
+               long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this_ptr == null ? 0 : this_ptr.ptr & ~1);
                this.ptrs_to.add(this_ptr);
                return ret;
        }
 
        public void set_next_remote_commitment_number(ChannelReestablish this_ptr, long val) {
-               bindings.ChannelReestablish_set_next_remote_commitment_number(this_ptr.ptr & ~1, val);
+               bindings.ChannelReestablish_set_next_remote_commitment_number(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
                this.ptrs_to.add(this_ptr);
        }
 
-       // Skipped ChannelReestablish_write
-       // Skipped ChannelReestablish_read
+       public byte[] write(ChannelReestablish obj) {
+               byte[] ret = bindings.ChannelReestablish_write(obj == null ? 0 : obj.ptr & ~1);
+               this.ptrs_to.add(obj);
+               return ret;
+       }
+
+       public ChannelReestablish(byte[] ser) {
+               super(bindings.ChannelReestablish_read(ser));
+       }
+
 }