Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / NodeAnnouncement.java
index 26cdd5821d8df4ea04ad86dec33b226d21919154..40c01d80ac1a3c7a13b9827b078aaed972af45dd 100644 (file)
@@ -4,7 +4,12 @@ import org.ldk.impl.bindings;
 import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
+import javax.annotation.Nullable;
 
+
+/**
+ * A node_announcement message to be sent or received from a peer
+ */
 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class NodeAnnouncement extends CommonBase {
        NodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
@@ -14,51 +19,76 @@ public class NodeAnnouncement extends CommonBase {
                if (ptr != 0) { bindings.NodeAnnouncement_free(ptr); }
        }
 
-       public NodeAnnouncement clone() {
-               long ret = bindings.NodeAnnouncement_clone(this.ptr);
-               NodeAnnouncement ret_hu_conv = new NodeAnnouncement(null, ret);
-               ret_hu_conv.ptrs_to.add(this);
-               return ret_hu_conv;
-       }
-
+       /**
+        * The signature by the node key
+        */
        public byte[] get_signature() {
                byte[] ret = bindings.NodeAnnouncement_get_signature(this.ptr);
                return ret;
        }
 
+       /**
+        * The signature by the node key
+        */
        public void set_signature(byte[] val) {
                bindings.NodeAnnouncement_set_signature(this.ptr, val);
        }
 
+       /**
+        * The actual content of the announcement
+        */
        public UnsignedNodeAnnouncement get_contents() {
                long ret = bindings.NodeAnnouncement_get_contents(this.ptr);
-               UnsignedNodeAnnouncement ret_hu_conv = new UnsignedNodeAnnouncement(null, ret);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedNodeAnnouncement(null, ret); }
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
        }
 
+       /**
+        * The actual content of the announcement
+        */
        public void set_contents(UnsignedNodeAnnouncement val) {
                bindings.NodeAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr & ~1);
-               this.ptrs_to.add(val);
        }
 
-       public static NodeAnnouncement constructor_new(byte[] signature_arg, UnsignedNodeAnnouncement contents_arg) {
+       /**
+        * Constructs a new NodeAnnouncement given each field
+        */
+       public static NodeAnnouncement of(byte[] signature_arg, UnsignedNodeAnnouncement contents_arg) {
                long ret = bindings.NodeAnnouncement_new(signature_arg, contents_arg == null ? 0 : contents_arg.ptr & ~1);
-               NodeAnnouncement ret_hu_conv = new NodeAnnouncement(null, ret);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeAnnouncement(null, ret); }
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               ret_hu_conv.ptrs_to.add(contents_arg);
                return ret_hu_conv;
        }
 
+       /**
+        * Creates a copy of the NodeAnnouncement
+        */
+       public NodeAnnouncement clone() {
+               long ret = bindings.NodeAnnouncement_clone(this.ptr);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeAnnouncement(null, ret); }
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
+        */
        public byte[] write() {
                byte[] ret = bindings.NodeAnnouncement_write(this.ptr);
                return ret;
        }
 
-       public static NodeAnnouncement constructor_read(byte[] ser) {
+       /**
+        * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
+        */
+       public static Result_NodeAnnouncementDecodeErrorZ read(byte[] ser) {
                long ret = bindings.NodeAnnouncement_read(ser);
-               NodeAnnouncement ret_hu_conv = new NodeAnnouncement(null, ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }