Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / PayeePubKey.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * Payee public key
13  */
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 {
19                 super.finalize();
20                 if (ptr != 0) { bindings.PayeePubKey_free(ptr); }
21         }
22
23         public byte[] get_a() {
24                 byte[] ret = bindings.PayeePubKey_get_a(this.ptr);
25                 Reference.reachabilityFence(this);
26                 return ret;
27         }
28
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);
33         }
34
35         /**
36          * Constructs a new PayeePubKey given each field
37          */
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);
44                 return ret_hu_conv;
45         }
46
47         long clone_ptr() {
48                 long ret = bindings.PayeePubKey_clone_ptr(this.ptr);
49                 Reference.reachabilityFence(this);
50                 return ret;
51         }
52
53         /**
54          * Creates a copy of the PayeePubKey
55          */
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);
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Checks if two PayeePubKeys contain equal inner contents.
67          */
68         public long hash() {
69                 long ret = bindings.PayeePubKey_hash(this.ptr);
70                 Reference.reachabilityFence(this);
71                 return ret;
72         }
73
74         @Override public int hashCode() {
75                 return (int)this.hash();
76         }
77         /**
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.
81          */
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);
86                 this.ptrs_to.add(b);
87                 return ret;
88         }
89
90         @Override public boolean equals(Object o) {
91                 if (!(o instanceof PayeePubKey)) return false;
92                 return this.eq((PayeePubKey)o);
93         }
94 }