[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / ProbeSendFailure.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  * Indicates that we failed to send a payment probe. Further errors may be surfaced later via
13  * [`Event::ProbeFailed`].
14  * 
15  * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed
16  */
17 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class ProbeSendFailure extends CommonBase {
19         private ProbeSendFailure(Object _dummy, long ptr) { super(ptr); }
20         @Override @SuppressWarnings("deprecation")
21         protected void finalize() throws Throwable {
22                 super.finalize();
23                 if (ptr != 0) { bindings.ProbeSendFailure_free(ptr); }
24         }
25         static ProbeSendFailure constr_from_ptr(long ptr) {
26                 bindings.LDKProbeSendFailure raw_val = bindings.LDKProbeSendFailure_ref_from_ptr(ptr);
27                 if (raw_val.getClass() == bindings.LDKProbeSendFailure.RouteNotFound.class) {
28                         return new RouteNotFound(ptr, (bindings.LDKProbeSendFailure.RouteNotFound)raw_val);
29                 }
30                 if (raw_val.getClass() == bindings.LDKProbeSendFailure.SendingFailed.class) {
31                         return new SendingFailed(ptr, (bindings.LDKProbeSendFailure.SendingFailed)raw_val);
32                 }
33                 assert false; return null; // Unreachable without extending the (internal) bindings interface
34         }
35
36         /**
37          * We were unable to find a route to the destination.
38          */
39         public final static class RouteNotFound extends ProbeSendFailure {
40                 private RouteNotFound(long ptr, bindings.LDKProbeSendFailure.RouteNotFound obj) {
41                         super(null, ptr);
42                 }
43         }
44         /**
45          * We failed to send the payment probes.
46          */
47         public final static class SendingFailed extends ProbeSendFailure {
48                 public final org.ldk.structs.PaymentSendFailure sending_failed;
49                 private SendingFailed(long ptr, bindings.LDKProbeSendFailure.SendingFailed obj) {
50                         super(null, ptr);
51                         long sending_failed = obj.sending_failed;
52                         org.ldk.structs.PaymentSendFailure sending_failed_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(sending_failed);
53                         if (sending_failed_hu_conv != null) { sending_failed_hu_conv.ptrs_to.add(this); };
54                         this.sending_failed = sending_failed_hu_conv;
55                 }
56         }
57         long clone_ptr() {
58                 long ret = bindings.ProbeSendFailure_clone_ptr(this.ptr);
59                 Reference.reachabilityFence(this);
60                 return ret;
61         }
62
63         /**
64          * Creates a copy of the ProbeSendFailure
65          */
66         public ProbeSendFailure clone() {
67                 long ret = bindings.ProbeSendFailure_clone(this.ptr);
68                 Reference.reachabilityFence(this);
69                 if (ret >= 0 && ret <= 4096) { return null; }
70                 org.ldk.structs.ProbeSendFailure ret_hu_conv = org.ldk.structs.ProbeSendFailure.constr_from_ptr(ret);
71                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
72                 return ret_hu_conv;
73         }
74
75         /**
76          * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure
77          */
78         public static ProbeSendFailure route_not_found() {
79                 long ret = bindings.ProbeSendFailure_route_not_found();
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 org.ldk.structs.ProbeSendFailure ret_hu_conv = org.ldk.structs.ProbeSendFailure.constr_from_ptr(ret);
82                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
83                 return ret_hu_conv;
84         }
85
86         /**
87          * Utility method to constructs a new SendingFailed-variant ProbeSendFailure
88          */
89         public static ProbeSendFailure sending_failed(org.ldk.structs.PaymentSendFailure a) {
90                 long ret = bindings.ProbeSendFailure_sending_failed(a.ptr);
91                 Reference.reachabilityFence(a);
92                 if (ret >= 0 && ret <= 4096) { return null; }
93                 org.ldk.structs.ProbeSendFailure ret_hu_conv = org.ldk.structs.ProbeSendFailure.constr_from_ptr(ret);
94                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
95                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
96                 return ret_hu_conv;
97         }
98
99         /**
100          * Checks if two ProbeSendFailures contain equal inner contents.
101          * This ignores pointers and is_owned flags and looks at the values in fields.
102          */
103         public boolean eq(org.ldk.structs.ProbeSendFailure b) {
104                 boolean ret = bindings.ProbeSendFailure_eq(this.ptr, b == null ? 0 : b.ptr);
105                 Reference.reachabilityFence(this);
106                 Reference.reachabilityFence(b);
107                 return ret;
108         }
109
110         @Override public boolean equals(Object o) {
111                 if (!(o instanceof ProbeSendFailure)) return false;
112                 return this.eq((ProbeSendFailure)o);
113         }
114 }