1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * Features used within an invoice.
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 {
20 if (ptr != 0) { bindings.InvoiceFeatures_free(ptr); }
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.
28 public boolean eq(org.ldk.structs.InvoiceFeatures b) {
29 boolean ret = bindings.InvoiceFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
30 Reference.reachabilityFence(this);
31 Reference.reachabilityFence(b);
32 if (this != null) { this.ptrs_to.add(b); };
36 @Override public boolean equals(Object o) {
37 if (!(o instanceof InvoiceFeatures)) return false;
38 return this.eq((InvoiceFeatures)o);
41 long ret = bindings.InvoiceFeatures_clone_ptr(this.ptr);
42 Reference.reachabilityFence(this);
47 * Creates a copy of the InvoiceFeatures
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 org.ldk.structs.InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceFeatures(null, ret); }
54 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
59 * Create a blank Features with no features set
61 public static InvoiceFeatures empty() {
62 long ret = bindings.InvoiceFeatures_empty();
63 if (ret >= 0 && ret <= 4096) { return null; }
64 org.ldk.structs.InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceFeatures(null, ret); }
65 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
70 * Returns true if this `Features` object contains unknown feature flags which are set as
73 public boolean requires_unknown_bits() {
74 boolean ret = bindings.InvoiceFeatures_requires_unknown_bits(this.ptr);
75 Reference.reachabilityFence(this);
80 * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
82 public byte[] write() {
83 byte[] ret = bindings.InvoiceFeatures_write(this.ptr);
84 Reference.reachabilityFence(this);
89 * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
91 public static Result_InvoiceFeaturesDecodeErrorZ read(byte[] ser) {
92 long ret = bindings.InvoiceFeatures_read(ser);
93 Reference.reachabilityFence(ser);
94 if (ret >= 0 && ret <= 4096) { return null; }
95 Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret);
100 * Set this feature as optional.
102 public void set_variable_length_onion_optional() {
103 bindings.InvoiceFeatures_set_variable_length_onion_optional(this.ptr);
104 Reference.reachabilityFence(this);
108 * Set this feature as required.
110 public void set_variable_length_onion_required() {
111 bindings.InvoiceFeatures_set_variable_length_onion_required(this.ptr);
112 Reference.reachabilityFence(this);
116 * Checks if this feature is supported.
118 public boolean supports_variable_length_onion() {
119 boolean ret = bindings.InvoiceFeatures_supports_variable_length_onion(this.ptr);
120 Reference.reachabilityFence(this);
125 * Checks if this feature is required.
127 public boolean requires_variable_length_onion() {
128 boolean ret = bindings.InvoiceFeatures_requires_variable_length_onion(this.ptr);
129 Reference.reachabilityFence(this);
134 * Set this feature as optional.
136 public void set_payment_secret_optional() {
137 bindings.InvoiceFeatures_set_payment_secret_optional(this.ptr);
138 Reference.reachabilityFence(this);
142 * Set this feature as required.
144 public void set_payment_secret_required() {
145 bindings.InvoiceFeatures_set_payment_secret_required(this.ptr);
146 Reference.reachabilityFence(this);
150 * Checks if this feature is supported.
152 public boolean supports_payment_secret() {
153 boolean ret = bindings.InvoiceFeatures_supports_payment_secret(this.ptr);
154 Reference.reachabilityFence(this);
159 * Checks if this feature is required.
161 public boolean requires_payment_secret() {
162 boolean ret = bindings.InvoiceFeatures_requires_payment_secret(this.ptr);
163 Reference.reachabilityFence(this);
168 * Set this feature as optional.
170 public void set_basic_mpp_optional() {
171 bindings.InvoiceFeatures_set_basic_mpp_optional(this.ptr);
172 Reference.reachabilityFence(this);
176 * Set this feature as required.
178 public void set_basic_mpp_required() {
179 bindings.InvoiceFeatures_set_basic_mpp_required(this.ptr);
180 Reference.reachabilityFence(this);
184 * Checks if this feature is supported.
186 public boolean supports_basic_mpp() {
187 boolean ret = bindings.InvoiceFeatures_supports_basic_mpp(this.ptr);
188 Reference.reachabilityFence(this);
193 * Checks if this feature is required.
195 public boolean requires_basic_mpp() {
196 boolean ret = bindings.InvoiceFeatures_requires_basic_mpp(this.ptr);
197 Reference.reachabilityFence(this);
202 * Set this feature as optional.
204 public void set_payment_metadata_optional() {
205 bindings.InvoiceFeatures_set_payment_metadata_optional(this.ptr);
206 Reference.reachabilityFence(this);
210 * Set this feature as required.
212 public void set_payment_metadata_required() {
213 bindings.InvoiceFeatures_set_payment_metadata_required(this.ptr);
214 Reference.reachabilityFence(this);
218 * Checks if this feature is supported.
220 public boolean supports_payment_metadata() {
221 boolean ret = bindings.InvoiceFeatures_supports_payment_metadata(this.ptr);
222 Reference.reachabilityFence(this);
227 * Checks if this feature is required.
229 public boolean requires_payment_metadata() {
230 boolean ret = bindings.InvoiceFeatures_requires_payment_metadata(this.ptr);
231 Reference.reachabilityFence(this);