Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Init.java
index 3c998bd972e025d8c22fda76e8505ba2bf3333e1..c108fd98fccfa73262030f735f4979735d58e10a 100644 (file)
@@ -2,28 +2,84 @@ package org.ldk.structs;
 
 import org.ldk.impl.bindings;
 import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
 
+
+/**
+ * An init message to be sent or received from a peer
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class Init extends CommonBase {
        Init(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
                super.finalize();
-               bindings.Init_free(ptr);
+               if (ptr != 0) { bindings.Init_free(ptr); }
+       }
+
+       /**
+        * The relevant features which the sender supports
+        */
+       public InitFeatures get_features() {
+               long ret = bindings.Init_get_features(this.ptr);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InitFeatures(null, ret); }
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       /**
+        * The relevant features which the sender supports
+        */
+       public void set_features(InitFeatures val) {
+               bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
+       }
+
+       /**
+        * Constructs a new Init given each field
+        */
+       public static Init of(InitFeatures features_arg) {
+               long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Init(null, ret); }
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       long clone_ptr() {
+               long ret = bindings.Init_clone_ptr(this.ptr);
+               return ret;
        }
 
-       public Init(Init orig) {
-               super(bindings.Init_clone(orig == null ? 0 : orig.ptr & ~1));
-               this.ptrs_to.add(orig);
+       /**
+        * Creates a copy of the Init
+        */
+       public Init clone() {
+               long ret = bindings.Init_clone(this.ptr);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Init(null, ret); }
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
        }
 
-       public byte[] write(Init obj) {
-               byte[] ret = bindings.Init_write(obj == null ? 0 : obj.ptr & ~1);
-               this.ptrs_to.add(obj);
+       /**
+        * Serialize the Init object into a byte array which can be read by Init_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.Init_write(this.ptr);
                return ret;
        }
 
-       public Init(byte[] ser) {
-               super(bindings.Init_read(ser));
+       /**
+        * Read a Init from a byte array, created by Init_write
+        */
+       public static Result_InitDecodeErrorZ read(byte[] ser) {
+               long ret = bindings.Init_read(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
        }
 
 }