Update auto-updated Java files
[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 java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * Features used within an invoice.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class InvoiceFeatures extends CommonBase {
16         InvoiceFeatures(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.InvoiceFeatures_free(ptr); }
21         }
22
23         /**
24          * Checks if two InvoiceFeaturess contain equal inner contents.
25          * This ignores pointers and is_owned flags and looks at the values in fields.
26          * Two objects with NULL inner values will be considered "equal" here.
27          */
28         public boolean eq(InvoiceFeatures b) {
29                 boolean ret = bindings.InvoiceFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
30                 Reference.reachabilityFence(this);
31                 Reference.reachabilityFence(b);
32                 this.ptrs_to.add(b);
33                 return ret;
34         }
35
36         @Override public boolean equals(Object o) {
37                 if (!(o instanceof InvoiceFeatures)) return false;
38                 return this.eq((InvoiceFeatures)o);
39         }
40         long clone_ptr() {
41                 long ret = bindings.InvoiceFeatures_clone_ptr(this.ptr);
42                 Reference.reachabilityFence(this);
43                 return ret;
44         }
45
46         /**
47          * Creates a copy of the InvoiceFeatures
48          */
49         public InvoiceFeatures clone() {
50                 long ret = bindings.InvoiceFeatures_clone(this.ptr);
51                 Reference.reachabilityFence(this);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); }
54                 ret_hu_conv.ptrs_to.add(this);
55                 return ret_hu_conv;
56         }
57
58         /**
59          * Create a blank Features with no features set
60          */
61         public static InvoiceFeatures empty() {
62                 long ret = bindings.InvoiceFeatures_empty();
63                 if (ret >= 0 && ret <= 4096) { return null; }
64                 InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); }
65                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Creates a Features with the bits set which are known by the implementation
71          */
72         public static InvoiceFeatures known() {
73                 long ret = bindings.InvoiceFeatures_known();
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); }
76                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
77                 return ret_hu_conv;
78         }
79
80         /**
81          * Returns true if this `Features` object contains unknown feature flags which are set as
82          * \"required\".
83          */
84         public boolean requires_unknown_bits() {
85                 boolean ret = bindings.InvoiceFeatures_requires_unknown_bits(this.ptr);
86                 Reference.reachabilityFence(this);
87                 return ret;
88         }
89
90         /**
91          * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
92          */
93         public byte[] write() {
94                 byte[] ret = bindings.InvoiceFeatures_write(this.ptr);
95                 Reference.reachabilityFence(this);
96                 return ret;
97         }
98
99         /**
100          * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
101          */
102         public static Result_InvoiceFeaturesDecodeErrorZ read(byte[] ser) {
103                 long ret = bindings.InvoiceFeatures_read(ser);
104                 Reference.reachabilityFence(ser);
105                 if (ret >= 0 && ret <= 4096) { return null; }
106                 Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret);
107                 return ret_hu_conv;
108         }
109
110 }