a935293794e15901ddae3c0f75acce171f1ad38e
[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                         msg_hu_conv.ptrs_to.add(this);
37                         this.msg = msg_hu_conv;
38                 }
39         }
40         public final static class ChannelClosed extends HTLCFailChannelUpdate {
41                 public final long short_channel_id;
42                 public final boolean is_permanent;
43                 private ChannelClosed(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelClosed obj) {
44                         super(null, ptr);
45                         this.short_channel_id = obj.short_channel_id;
46                         this.is_permanent = obj.is_permanent;
47                 }
48         }
49         public final static class NodeFailure extends HTLCFailChannelUpdate {
50                 public final byte[] node_id;
51                 public final boolean is_permanent;
52                 private NodeFailure(long ptr, bindings.LDKHTLCFailChannelUpdate.NodeFailure obj) {
53                         super(null, ptr);
54                         this.node_id = obj.node_id;
55                         this.is_permanent = obj.is_permanent;
56                 }
57         }
58 }