[Java] Update auto-generated bindings to 0.0.115
[ldk-java] / src / main / java / org / ldk / structs / BlindedHop.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  * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified
13  * by outside observers and thus can be used to hide the identity of the recipient.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class BlindedHop extends CommonBase {
17         BlindedHop(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.BlindedHop_free(ptr); }
22         }
23
24         long clone_ptr() {
25                 long ret = bindings.BlindedHop_clone_ptr(this.ptr);
26                 Reference.reachabilityFence(this);
27                 return ret;
28         }
29
30         /**
31          * Creates a copy of the BlindedHop
32          */
33         public BlindedHop clone() {
34                 long ret = bindings.BlindedHop_clone(this.ptr);
35                 Reference.reachabilityFence(this);
36                 if (ret >= 0 && ret <= 4096) { return null; }
37                 org.ldk.structs.BlindedHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHop(null, ret); }
38                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
39                 return ret_hu_conv;
40         }
41
42         /**
43          * Generates a non-cryptographic 64-bit hash of the BlindedHop.
44          */
45         public long hash() {
46                 long ret = bindings.BlindedHop_hash(this.ptr);
47                 Reference.reachabilityFence(this);
48                 return ret;
49         }
50
51         @Override public int hashCode() {
52                 return (int)this.hash();
53         }
54         /**
55          * Checks if two BlindedHops contain equal inner contents.
56          * This ignores pointers and is_owned flags and looks at the values in fields.
57          * Two objects with NULL inner values will be considered "equal" here.
58          */
59         public boolean eq(org.ldk.structs.BlindedHop b) {
60                 boolean ret = bindings.BlindedHop_eq(this.ptr, b == null ? 0 : b.ptr);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(b);
63                 if (this != null) { this.ptrs_to.add(b); };
64                 return ret;
65         }
66
67         @Override public boolean equals(Object o) {
68                 if (!(o instanceof BlindedHop)) return false;
69                 return this.eq((BlindedHop)o);
70         }
71         /**
72          * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read
73          */
74         public byte[] write() {
75                 byte[] ret = bindings.BlindedHop_write(this.ptr);
76                 Reference.reachabilityFence(this);
77                 return ret;
78         }
79
80         /**
81          * Read a BlindedHop from a byte array, created by BlindedHop_write
82          */
83         public static Result_BlindedHopDecodeErrorZ read(byte[] ser) {
84                 long ret = bindings.BlindedHop_read(ser);
85                 Reference.reachabilityFence(ser);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 Result_BlindedHopDecodeErrorZ ret_hu_conv = Result_BlindedHopDecodeErrorZ.constr_from_ptr(ret);
88                 return ret_hu_conv;
89         }
90
91 }