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;
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class PayeePubKey extends CommonBase {
16 PayeePubKey(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.PayeePubKey_free(ptr); }
23 public byte[] get_a() {
24 byte[] ret = bindings.PayeePubKey_get_a(this.ptr);
25 Reference.reachabilityFence(this);
29 public void set_a(byte[] val) {
30 bindings.PayeePubKey_set_a(this.ptr, InternalUtils.check_arr_len(val, 33));
31 Reference.reachabilityFence(this);
32 Reference.reachabilityFence(val);
36 * Constructs a new PayeePubKey given each field
38 public static PayeePubKey of(byte[] a_arg) {
39 long ret = bindings.PayeePubKey_new(InternalUtils.check_arr_len(a_arg, 33));
40 Reference.reachabilityFence(a_arg);
41 if (ret >= 0 && ret <= 4096) { return null; }
42 PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PayeePubKey(null, ret); }
43 ret_hu_conv.ptrs_to.add(ret_hu_conv);
48 long ret = bindings.PayeePubKey_clone_ptr(this.ptr);
49 Reference.reachabilityFence(this);
54 * Creates a copy of the PayeePubKey
56 public PayeePubKey clone() {
57 long ret = bindings.PayeePubKey_clone(this.ptr);
58 Reference.reachabilityFence(this);
59 if (ret >= 0 && ret <= 4096) { return null; }
60 PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PayeePubKey(null, ret); }
61 ret_hu_conv.ptrs_to.add(this);
66 * Checks if two PayeePubKeys contain equal inner contents.
69 long ret = bindings.PayeePubKey_hash(this.ptr);
70 Reference.reachabilityFence(this);
74 @Override public int hashCode() {
75 return (int)this.hash();
78 * Checks if two PayeePubKeys contain equal inner contents.
79 * This ignores pointers and is_owned flags and looks at the values in fields.
80 * Two objects with NULL inner values will be considered "equal" here.
82 public boolean eq(PayeePubKey b) {
83 boolean ret = bindings.PayeePubKey_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
84 Reference.reachabilityFence(this);
85 Reference.reachabilityFence(b);
90 @Override public boolean equals(Object o) {
91 if (!(o instanceof PayeePubKey)) return false;
92 return this.eq((PayeePubKey)o);