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 `init` message.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class InitFeatures extends CommonBase {
15 InitFeatures(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.InitFeatures_free(ptr); }
23 * Checks if two InitFeaturess 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(InitFeatures b) {
28 boolean ret = bindings.InitFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
34 * Creates a copy of the InitFeatures
36 public InitFeatures clone() {
37 long ret = bindings.InitFeatures_clone(this.ptr);
38 if (ret < 1024) { return null; }
39 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
40 ret_hu_conv.ptrs_to.add(this);
45 * Create a blank Features with no features set
47 public static InitFeatures empty() {
48 long ret = bindings.InitFeatures_empty();
49 if (ret < 1024) { return null; }
50 InitFeatures ret_hu_conv = new InitFeatures(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 InitFeatures known() {
59 long ret = bindings.InitFeatures_known();
60 if (ret < 1024) { return null; }
61 InitFeatures ret_hu_conv = new InitFeatures(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.InitFeatures_requires_unknown_bits(this.ptr);
76 * Returns whether the `payment_secret` feature is supported.
78 public boolean supports_payment_secret() {
79 boolean ret = bindings.InitFeatures_supports_payment_secret(this.ptr);
84 * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
86 public byte[] write() {
87 byte[] ret = bindings.InitFeatures_write(this.ptr);
92 * Read a InitFeatures from a byte array, created by InitFeatures_write
94 public static Result_InitFeaturesDecodeErrorZ read(byte[] ser) {
95 long ret = bindings.InitFeatures_read(ser);
96 if (ret < 1024) { return null; }
97 Result_InitFeaturesDecodeErrorZ ret_hu_conv = Result_InitFeaturesDecodeErrorZ.constr_from_ptr(ret);