Update java bindings with new generator and new upstream code
[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
8
9 /**
10  * Features used within a `node_announcement` message.
11  */
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class NodeFeatures extends CommonBase {
14         NodeFeatures(Object _dummy, long ptr) { super(ptr); }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 super.finalize();
18                 if (ptr != 0) { bindings.NodeFeatures_free(ptr); }
19         }
20
21         /**
22          * Creates a copy of the NodeFeatures
23          */
24         public NodeFeatures clone() {
25                 long ret = bindings.NodeFeatures_clone(this.ptr);
26                 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
27                 ret_hu_conv.ptrs_to.add(this);
28                 return ret_hu_conv;
29         }
30
31         /**
32          * Create a blank Features with no features set
33          */
34         public static NodeFeatures constructor_empty() {
35                 long ret = bindings.NodeFeatures_empty();
36                 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
37                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
38                 return ret_hu_conv;
39         }
40
41         /**
42          * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
43          * 
44          * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
45          */
46         public static NodeFeatures constructor_known() {
47                 long ret = bindings.NodeFeatures_known();
48                 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
49                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
50                 return ret_hu_conv;
51         }
52
53         /**
54          * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
55          */
56         public byte[] write() {
57                 byte[] ret = bindings.NodeFeatures_write(this.ptr);
58                 return ret;
59         }
60
61         /**
62          * Read a NodeFeatures from a byte array, created by NodeFeatures_write
63          */
64         public static Result_NodeFeaturesDecodeErrorZ constructor_read(byte[] ser) {
65                 long ret = bindings.NodeFeatures_read(ser);
66                 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
67                 return ret_hu_conv;
68         }
69
70 }