]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/APIError.java
Fix race in tests
[ldk-java] / src / main / java / org / ldk / structs / APIError.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
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class APIError extends CommonBase {
10         private APIError(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.APIError_free(ptr); }
15         }
16         static APIError constr_from_ptr(long ptr) {
17                 bindings.LDKAPIError raw_val = bindings.LDKAPIError_ref_from_ptr(ptr);
18                 if (raw_val.getClass() == bindings.LDKAPIError.APIMisuseError.class) {
19                         return new APIMisuseError(ptr, (bindings.LDKAPIError.APIMisuseError)raw_val);
20                 }
21                 if (raw_val.getClass() == bindings.LDKAPIError.FeeRateTooHigh.class) {
22                         return new FeeRateTooHigh(ptr, (bindings.LDKAPIError.FeeRateTooHigh)raw_val);
23                 }
24                 if (raw_val.getClass() == bindings.LDKAPIError.RouteError.class) {
25                         return new RouteError(ptr, (bindings.LDKAPIError.RouteError)raw_val);
26                 }
27                 if (raw_val.getClass() == bindings.LDKAPIError.ChannelUnavailable.class) {
28                         return new ChannelUnavailable(ptr, (bindings.LDKAPIError.ChannelUnavailable)raw_val);
29                 }
30                 if (raw_val.getClass() == bindings.LDKAPIError.MonitorUpdateFailed.class) {
31                         return new MonitorUpdateFailed(ptr, (bindings.LDKAPIError.MonitorUpdateFailed)raw_val);
32                 }
33                 assert false; return null; // Unreachable without extending the (internal) bindings interface
34         }
35
36         public final static class APIMisuseError extends APIError {
37                 public final byte[] err;
38                 private APIMisuseError(long ptr, bindings.LDKAPIError.APIMisuseError obj) {
39                         super(null, ptr);
40                         this.err = obj.err;
41                 }
42         }
43         public final static class FeeRateTooHigh extends APIError {
44                 public final byte[] err;
45                 public final int feerate;
46                 private FeeRateTooHigh(long ptr, bindings.LDKAPIError.FeeRateTooHigh obj) {
47                         super(null, ptr);
48                         this.err = obj.err;
49                         this.feerate = obj.feerate;
50                 }
51         }
52         public final static class RouteError extends APIError {
53                 public final String err;
54                 private RouteError(long ptr, bindings.LDKAPIError.RouteError obj) {
55                         super(null, ptr);
56                         this.err = obj.err;
57                 }
58         }
59         public final static class ChannelUnavailable extends APIError {
60                 public final byte[] err;
61                 private ChannelUnavailable(long ptr, bindings.LDKAPIError.ChannelUnavailable obj) {
62                         super(null, ptr);
63                         this.err = obj.err;
64                 }
65         }
66         public final static class MonitorUpdateFailed extends APIError {
67                 private MonitorUpdateFailed(long ptr, bindings.LDKAPIError.MonitorUpdateFailed obj) {
68                         super(null, ptr);
69                 }
70         }
71 }