Merge pull request #42 from TheBlueMatt/main
[ldk-java] / src / main / java / org / ldk / structs / InvoiceFeatures.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 invoice.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class InvoiceFeatures extends CommonBase {
15         InvoiceFeatures(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.InvoiceFeatures_free(ptr); }
20         }
21
22         /**
23          * Checks if two InvoiceFeaturess 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(InvoiceFeatures b) {
28                 boolean ret = bindings.InvoiceFeatures_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 InvoiceFeatures
35          */
36         public InvoiceFeatures clone() {
37                 long ret = bindings.InvoiceFeatures_clone(this.ptr);
38                 if (ret < 1024) { return null; }
39                 InvoiceFeatures ret_hu_conv = new InvoiceFeatures(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 InvoiceFeatures empty() {
48                 long ret = bindings.InvoiceFeatures_empty();
49                 if (ret < 1024) { return null; }
50                 InvoiceFeatures ret_hu_conv = new InvoiceFeatures(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 InvoiceFeatures known() {
59                 long ret = bindings.InvoiceFeatures_known();
60                 if (ret < 1024) { return null; }
61                 InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret);
62                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Returns whether the `payment_secret` feature is supported.
68          */
69         public boolean supports_payment_secret() {
70                 boolean ret = bindings.InvoiceFeatures_supports_payment_secret(this.ptr);
71                 return ret;
72         }
73
74         /**
75          * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
76          */
77         public byte[] write() {
78                 byte[] ret = bindings.InvoiceFeatures_write(this.ptr);
79                 return ret;
80         }
81
82         /**
83          * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
84          */
85         public static Result_InvoiceFeaturesDecodeErrorZ read(byte[] ser) {
86                 long ret = bindings.InvoiceFeatures_read(ser);
87                 if (ret < 1024) { return null; }
88                 Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret);
89                 return ret_hu_conv;
90         }
91
92 }