1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Features used within a `node_announcement` message.
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class NodeFeatures extends CommonBase {
14 NodeFeatures(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.NodeFeatures_free(ptr); }
22 * Checks if two NodeFeaturess contain equal inner contents.
23 * This ignores pointers and is_owned flags and looks at the values in fields.
24 * Two objects with NULL inner values will be considered "equal" here.
26 public boolean eq(NodeFeatures b) {
27 boolean ret = bindings.NodeFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
33 * Creates a copy of the NodeFeatures
35 public NodeFeatures clone() {
36 long ret = bindings.NodeFeatures_clone(this.ptr);
37 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
38 ret_hu_conv.ptrs_to.add(this);
43 * Create a blank Features with no features set
45 public static NodeFeatures empty() {
46 long ret = bindings.NodeFeatures_empty();
47 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
48 ret_hu_conv.ptrs_to.add(ret_hu_conv);
53 * Creates a Features with the bits set which are known by the implementation
55 public static NodeFeatures known() {
56 long ret = bindings.NodeFeatures_known();
57 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
58 ret_hu_conv.ptrs_to.add(ret_hu_conv);
63 * Returns whether the `payment_secret` feature is supported.
65 public boolean supports_payment_secret() {
66 boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
71 * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
73 public byte[] write() {
74 byte[] ret = bindings.NodeFeatures_write(this.ptr);
79 * Read a NodeFeatures from a byte array, created by NodeFeatures_write
81 public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
82 long ret = bindings.NodeFeatures_read(ser);
83 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);