Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / InitFeatures.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  * Features used within an `init` message.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class InitFeatures extends CommonBase {
15         InitFeatures(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.InitFeatures_free(ptr); }
20         }
21
22         /**
23          * Checks if two InitFeaturess contain equal inner contents.
24          * This ignores pointers and is_owned flags and looks at the values in fields.
25          * Two objects with NULL inner values will be considered "equal" here.
26          */
27         public boolean eq(InitFeatures b) {
28                 boolean ret = bindings.InitFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
29                 this.ptrs_to.add(b);
30                 return ret;
31         }
32
33         /**
34          * Creates a copy of the InitFeatures
35          */
36         public InitFeatures clone() {
37                 long ret = bindings.InitFeatures_clone(this.ptr);
38                 if (ret >= 0 && ret <= 4096) { return null; }
39                 InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InitFeatures(null, ret); }
40                 ret_hu_conv.ptrs_to.add(this);
41                 return ret_hu_conv;
42         }
43
44         /**
45          * Create a blank Features with no features set
46          */
47         public static InitFeatures empty() {
48                 long ret = bindings.InitFeatures_empty();
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InitFeatures(null, ret); }
51                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
52                 return ret_hu_conv;
53         }
54
55         /**
56          * Creates a Features with the bits set which are known by the implementation
57          */
58         public static InitFeatures known() {
59                 long ret = bindings.InitFeatures_known();
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InitFeatures(null, ret); }
62                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Returns true if this `Features` object contains unknown feature flags which are set as
68          * \"required\".
69          */
70         public boolean requires_unknown_bits() {
71                 boolean ret = bindings.InitFeatures_requires_unknown_bits(this.ptr);
72                 return ret;
73         }
74
75         /**
76          * Returns whether the `payment_secret` feature is supported.
77          */
78         public boolean supports_payment_secret() {
79                 boolean ret = bindings.InitFeatures_supports_payment_secret(this.ptr);
80                 return ret;
81         }
82
83         /**
84          * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
85          */
86         public byte[] write() {
87                 byte[] ret = bindings.InitFeatures_write(this.ptr);
88                 return ret;
89         }
90
91         /**
92          * Read a InitFeatures from a byte array, created by InitFeatures_write
93          */
94         public static Result_InitFeaturesDecodeErrorZ read(byte[] ser) {
95                 long ret = bindings.InitFeatures_read(ser);
96                 if (ret >= 0 && ret <= 4096) { return null; }
97                 Result_InitFeaturesDecodeErrorZ ret_hu_conv = Result_InitFeaturesDecodeErrorZ.constr_from_ptr(ret);
98                 return ret_hu_conv;
99         }
100
101 }