]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/ErrorAction.java
Fix race in tests
[ldk-java] / src / main / java / org / ldk / structs / ErrorAction.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 ErrorAction extends CommonBase {
10         private ErrorAction(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.ErrorAction_free(ptr); }
15         }
16         static ErrorAction constr_from_ptr(long ptr) {
17                 bindings.LDKErrorAction raw_val = bindings.LDKErrorAction_ref_from_ptr(ptr);
18                 if (raw_val.getClass() == bindings.LDKErrorAction.DisconnectPeer.class) {
19                         return new DisconnectPeer(ptr, (bindings.LDKErrorAction.DisconnectPeer)raw_val);
20                 }
21                 if (raw_val.getClass() == bindings.LDKErrorAction.IgnoreError.class) {
22                         return new IgnoreError(ptr, (bindings.LDKErrorAction.IgnoreError)raw_val);
23                 }
24                 if (raw_val.getClass() == bindings.LDKErrorAction.SendErrorMessage.class) {
25                         return new SendErrorMessage(ptr, (bindings.LDKErrorAction.SendErrorMessage)raw_val);
26                 }
27                 assert false; return null; // Unreachable without extending the (internal) bindings interface
28         }
29
30         public final static class DisconnectPeer extends ErrorAction {
31                 public final ErrorMessage msg;
32                 private DisconnectPeer(long ptr, bindings.LDKErrorAction.DisconnectPeer obj) {
33                         super(null, ptr);
34                         long msg = obj.msg;
35                         ErrorMessage msg_hu_conv = new ErrorMessage(null, msg);
36                         this.msg = msg_hu_conv;
37                 }
38         }
39         public final static class IgnoreError extends ErrorAction {
40                 private IgnoreError(long ptr, bindings.LDKErrorAction.IgnoreError obj) {
41                         super(null, ptr);
42                 }
43         }
44         public final static class SendErrorMessage extends ErrorAction {
45                 public final ErrorMessage msg;
46                 private SendErrorMessage(long ptr, bindings.LDKErrorAction.SendErrorMessage obj) {
47                         super(null, ptr);
48                         long msg = obj.msg;
49                         ErrorMessage msg_hu_conv = new ErrorMessage(null, msg);
50                         this.msg = msg_hu_conv;
51                 }
52         }
53 }