1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class Option_ChannelShutdownStateZ extends CommonBase {
16 private Option_ChannelShutdownStateZ(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.COption_ChannelShutdownStateZ_free(ptr); }
22 static Option_ChannelShutdownStateZ constr_from_ptr(long ptr) {
23 bindings.LDKCOption_ChannelShutdownStateZ raw_val = bindings.LDKCOption_ChannelShutdownStateZ_ref_from_ptr(ptr);
24 if (raw_val.getClass() == bindings.LDKCOption_ChannelShutdownStateZ.Some.class) {
25 return new Some(ptr, (bindings.LDKCOption_ChannelShutdownStateZ.Some)raw_val);
27 if (raw_val.getClass() == bindings.LDKCOption_ChannelShutdownStateZ.None.class) {
28 return new None(ptr, (bindings.LDKCOption_ChannelShutdownStateZ.None)raw_val);
30 assert false; return null; // Unreachable without extending the (internal) bindings interface
34 * When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState
36 public final static class Some extends Option_ChannelShutdownStateZ {
37 public final org.ldk.enums.ChannelShutdownState some;
38 private Some(long ptr, bindings.LDKCOption_ChannelShutdownStateZ.Some obj) {
44 * When we're in this state, this COption_ChannelShutdownStateZ contains nothing
46 public final static class None extends Option_ChannelShutdownStateZ {
47 private None(long ptr, bindings.LDKCOption_ChannelShutdownStateZ.None obj) {
52 * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState
54 public static Option_ChannelShutdownStateZ some(org.ldk.enums.ChannelShutdownState o) {
55 long ret = bindings.COption_ChannelShutdownStateZ_some(o);
56 Reference.reachabilityFence(o);
57 if (ret >= 0 && ret <= 4096) { return null; }
58 org.ldk.structs.Option_ChannelShutdownStateZ ret_hu_conv = org.ldk.structs.Option_ChannelShutdownStateZ.constr_from_ptr(ret);
59 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
64 * Constructs a new COption_ChannelShutdownStateZ containing nothing
66 public static Option_ChannelShutdownStateZ none() {
67 long ret = bindings.COption_ChannelShutdownStateZ_none();
68 if (ret >= 0 && ret <= 4096) { return null; }
69 org.ldk.structs.Option_ChannelShutdownStateZ ret_hu_conv = org.ldk.structs.Option_ChannelShutdownStateZ.constr_from_ptr(ret);
70 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
75 long ret = bindings.COption_ChannelShutdownStateZ_clone_ptr(this.ptr);
76 Reference.reachabilityFence(this);
81 * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig`
82 * but with all dynamically-allocated buffers duplicated in new buffers.
84 public Option_ChannelShutdownStateZ clone() {
85 long ret = bindings.COption_ChannelShutdownStateZ_clone(this.ptr);
86 Reference.reachabilityFence(this);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 org.ldk.structs.Option_ChannelShutdownStateZ ret_hu_conv = org.ldk.structs.Option_ChannelShutdownStateZ.constr_from_ptr(ret);
89 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };