1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * Features used within an invoice.
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 {
19 if (ptr != 0) { bindings.InvoiceFeatures_free(ptr); }
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.
27 public boolean eq(InvoiceFeatures b) {
28 boolean ret = bindings.InvoiceFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
34 * Creates a copy of the InvoiceFeatures
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);
45 * Create a blank Features with no features set
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);
56 * Creates a Features with the bits set which are known by the implementation
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);
67 * Returns true if this `Features` object contains unknown feature flags which are set as
70 public boolean requires_unknown_bits() {
71 boolean ret = bindings.InvoiceFeatures_requires_unknown_bits(this.ptr);
76 * Returns whether the `payment_secret` feature is supported.
78 public boolean supports_payment_secret() {
79 boolean ret = bindings.InvoiceFeatures_supports_payment_secret(this.ptr);
84 * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
86 public byte[] write() {
87 byte[] ret = bindings.InvoiceFeatures_write(this.ptr);
92 * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
94 public static Result_InvoiceFeaturesDecodeErrorZ read(byte[] ser) {
95 long ret = bindings.InvoiceFeatures_read(ser);
96 if (ret < 1024) { return null; }
97 Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret);