92a5c0188bf302edd9dd66b14f677648994b02b7
[ldk-java] / src / main / java / org / ldk / structs / HTLCFailChannelUpdate.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 HTLCFailChannelUpdate extends CommonBase {
10         private HTLCFailChannelUpdate(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.HTLCFailChannelUpdate_free(ptr); }
15         }
16         static HTLCFailChannelUpdate constr_from_ptr(long ptr) {
17                 bindings.LDKHTLCFailChannelUpdate raw_val = bindings.LDKHTLCFailChannelUpdate_ref_from_ptr(ptr);
18                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage.class) {
19                         return new ChannelUpdateMessage(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage)raw_val);
20                 }
21                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelClosed.class) {
22                         return new ChannelClosed(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelClosed)raw_val);
23                 }
24                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.NodeFailure.class) {
25                         return new NodeFailure(ptr, (bindings.LDKHTLCFailChannelUpdate.NodeFailure)raw_val);
26                 }
27                 assert false; return null; // Unreachable without extending the (internal) bindings interface
28         }
29
30         public final static class ChannelUpdateMessage extends HTLCFailChannelUpdate {
31                 public final ChannelUpdate msg;
32                 private ChannelUpdateMessage(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage obj) {
33                         super(null, ptr);
34                         long msg = obj.msg;
35                         ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
36                         this.msg = msg_hu_conv;
37                 }
38         }
39         public final static class ChannelClosed extends HTLCFailChannelUpdate {
40                 public final long short_channel_id;
41                 public final boolean is_permanent;
42                 private ChannelClosed(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelClosed obj) {
43                         super(null, ptr);
44                         this.short_channel_id = obj.short_channel_id;
45                         this.is_permanent = obj.is_permanent;
46                 }
47         }
48         public final static class NodeFailure extends HTLCFailChannelUpdate {
49                 public final byte[] node_id;
50                 public final boolean is_permanent;
51                 private NodeFailure(long ptr, bindings.LDKHTLCFailChannelUpdate.NodeFailure obj) {
52                         super(null, ptr);
53                         this.node_id = obj.node_id;
54                         this.is_permanent = obj.is_permanent;
55                 }
56         }
57 }