Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Init.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9
10 /**
11  * An init message to be sent or received from a peer
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class Init extends CommonBase {
15         Init(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.Init_free(ptr); }
20         }
21
22         /**
23          * The relevant features which the sender supports
24          */
25         public InitFeatures get_features() {
26                 long ret = bindings.Init_get_features(this.ptr);
27                 if (ret >= 0 && ret <= 4096) { return null; }
28                 InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InitFeatures(null, ret); }
29                 ret_hu_conv.ptrs_to.add(this);
30                 return ret_hu_conv;
31         }
32
33         /**
34          * The relevant features which the sender supports
35          */
36         public void set_features(InitFeatures val) {
37                 bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
38         }
39
40         /**
41          * Constructs a new Init given each field
42          */
43         public static Init of(InitFeatures features_arg) {
44                 long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1);
45                 if (ret >= 0 && ret <= 4096) { return null; }
46                 Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Init(null, ret); }
47                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
48                 return ret_hu_conv;
49         }
50
51         long clone_ptr() {
52                 long ret = bindings.Init_clone_ptr(this.ptr);
53                 return ret;
54         }
55
56         /**
57          * Creates a copy of the Init
58          */
59         public Init clone() {
60                 long ret = bindings.Init_clone(this.ptr);
61                 if (ret >= 0 && ret <= 4096) { return null; }
62                 Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Init(null, ret); }
63                 ret_hu_conv.ptrs_to.add(this);
64                 return ret_hu_conv;
65         }
66
67         /**
68          * Serialize the Init object into a byte array which can be read by Init_read
69          */
70         public byte[] write() {
71                 byte[] ret = bindings.Init_write(this.ptr);
72                 return ret;
73         }
74
75         /**
76          * Read a Init from a byte array, created by Init_write
77          */
78         public static Result_InitDecodeErrorZ read(byte[] ser) {
79                 long ret = bindings.Init_read(ser);
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret);
82                 return ret_hu_conv;
83         }
84
85 }