Make complex enums more complete, track reference-or-ownership by callsite
[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                 bindings.HTLCFailChannelUpdate_free(ptr);
15         }
16         long conv_to_c() { assert false; return 0; /* Should only be called on subclasses */ }
17         static HTLCFailChannelUpdate constr_from_ptr(long ptr) {
18                 bindings.LDKHTLCFailChannelUpdate raw_val = bindings.LDKHTLCFailChannelUpdate_ref_from_ptr(ptr);
19                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage.class) {
20                         return new ChannelUpdateMessage(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage)raw_val);
21                 }
22                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelClosed.class) {
23                         return new ChannelClosed(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelClosed)raw_val);
24                 }
25                 if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.NodeFailure.class) {
26                         return new NodeFailure(ptr, (bindings.LDKHTLCFailChannelUpdate.NodeFailure)raw_val);
27                 }
28                 assert false; return null; // Unreachable without extending the (internal) bindings interface
29         }
30
31         public final static class ChannelUpdateMessage extends HTLCFailChannelUpdate {
32                 public ChannelUpdate msg;
33                 private ChannelUpdateMessage(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage obj) {
34                         super(null, ptr);
35                         long msg = obj.msg;
36                         ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
37                         this.msg = msg_hu_conv;
38                 }
39                 @Override long conv_to_c() { return 0; /*XXX*/ }
40         }
41         public final static class ChannelClosed extends HTLCFailChannelUpdate {
42                 public long short_channel_id;
43                 public boolean is_permanent;
44                 private ChannelClosed(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelClosed obj) {
45                         super(null, ptr);
46                         this.short_channel_id = obj.short_channel_id;
47                         this.is_permanent = obj.is_permanent;
48                 }
49                 @Override long conv_to_c() { return 0; /*XXX*/ }
50         }
51         public final static class NodeFailure extends HTLCFailChannelUpdate {
52                 public byte[] node_id;
53                 public boolean is_permanent;
54                 private NodeFailure(long ptr, bindings.LDKHTLCFailChannelUpdate.NodeFailure obj) {
55                         super(null, ptr);
56                         this.node_id = obj.node_id;
57                         this.is_permanent = obj.is_permanent;
58                 }
59                 @Override long conv_to_c() { return 0; /*XXX*/ }
60         }
61 }