Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / NodeFeatures.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 a `node_announcement` message.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class NodeFeatures extends CommonBase {
15         NodeFeatures(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.NodeFeatures_free(ptr); }
20         }
21
22         /**
23          * Checks if two NodeFeaturess 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(NodeFeatures b) {
28                 boolean ret = bindings.NodeFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
29                 this.ptrs_to.add(b);
30                 return ret;
31         }
32
33         long clone_ptr() {
34                 long ret = bindings.NodeFeatures_clone_ptr(this.ptr);
35                 return ret;
36         }
37
38         /**
39          * Creates a copy of the NodeFeatures
40          */
41         public NodeFeatures clone() {
42                 long ret = bindings.NodeFeatures_clone(this.ptr);
43                 if (ret >= 0 && ret <= 4096) { return null; }
44                 NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); }
45                 ret_hu_conv.ptrs_to.add(this);
46                 return ret_hu_conv;
47         }
48
49         /**
50          * Create a blank Features with no features set
51          */
52         public static NodeFeatures empty() {
53                 long ret = bindings.NodeFeatures_empty();
54                 if (ret >= 0 && ret <= 4096) { return null; }
55                 NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); }
56                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
57                 return ret_hu_conv;
58         }
59
60         /**
61          * Creates a Features with the bits set which are known by the implementation
62          */
63         public static NodeFeatures known() {
64                 long ret = bindings.NodeFeatures_known();
65                 if (ret >= 0 && ret <= 4096) { return null; }
66                 NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); }
67                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
68                 return ret_hu_conv;
69         }
70
71         /**
72          * Returns true if this `Features` object contains unknown feature flags which are set as
73          * \"required\".
74          */
75         public boolean requires_unknown_bits() {
76                 boolean ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
77                 return ret;
78         }
79
80         /**
81          * Returns whether the `payment_secret` feature is supported.
82          */
83         public boolean supports_payment_secret() {
84                 boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
85                 return ret;
86         }
87
88         /**
89          * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
90          */
91         public byte[] write() {
92                 byte[] ret = bindings.NodeFeatures_write(this.ptr);
93                 return ret;
94         }
95
96         /**
97          * Read a NodeFeatures from a byte array, created by NodeFeatures_write
98          */
99         public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
100                 long ret = bindings.NodeFeatures_read(ser);
101                 if (ret >= 0 && ret <= 4096) { return null; }
102                 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
103                 return ret_hu_conv;
104         }
105
106 }