Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Option_MonitorEventZ.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 import javax.annotation.Nullable;
8
9
10 /**
11  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class Option_MonitorEventZ extends CommonBase {
15         private Option_MonitorEventZ(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.COption_MonitorEventZ_free(ptr); }
20         }
21         static Option_MonitorEventZ constr_from_ptr(long ptr) {
22                 bindings.LDKCOption_MonitorEventZ raw_val = bindings.LDKCOption_MonitorEventZ_ref_from_ptr(ptr);
23                 if (raw_val.getClass() == bindings.LDKCOption_MonitorEventZ.Some.class) {
24                         return new Some(ptr, (bindings.LDKCOption_MonitorEventZ.Some)raw_val);
25                 }
26                 if (raw_val.getClass() == bindings.LDKCOption_MonitorEventZ.None.class) {
27                         return new None(ptr, (bindings.LDKCOption_MonitorEventZ.None)raw_val);
28                 }
29                 assert false; return null; // Unreachable without extending the (internal) bindings interface
30         }
31
32         /**
33          * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
34          */
35         public final static class Some extends Option_MonitorEventZ {
36                 public final MonitorEvent some;
37                 private Some(long ptr, bindings.LDKCOption_MonitorEventZ.Some obj) {
38                         super(null, ptr);
39                         long some = obj.some;
40                         MonitorEvent some_hu_conv = MonitorEvent.constr_from_ptr(some);
41                         some_hu_conv.ptrs_to.add(this);
42                         this.some = some_hu_conv;
43                 }
44         }
45         /**
46          * When we're in this state, this COption_MonitorEventZ contains nothing
47          */
48         public final static class None extends Option_MonitorEventZ {
49                 private None(long ptr, bindings.LDKCOption_MonitorEventZ.None obj) {
50                         super(null, ptr);
51                 }
52         }
53         /**
54          * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
55          */
56         public static Option_MonitorEventZ some(MonitorEvent o) {
57                 long ret = bindings.COption_MonitorEventZ_some(o.ptr);
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 Option_MonitorEventZ ret_hu_conv = Option_MonitorEventZ.constr_from_ptr(ret);
60                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
61                 return ret_hu_conv;
62         }
63
64         /**
65          * Constructs a new COption_MonitorEventZ containing nothing
66          */
67         public static Option_MonitorEventZ none() {
68                 long ret = bindings.COption_MonitorEventZ_none();
69                 if (ret >= 0 && ret <= 4096) { return null; }
70                 Option_MonitorEventZ ret_hu_conv = Option_MonitorEventZ.constr_from_ptr(ret);
71                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
72                 return ret_hu_conv;
73         }
74
75         long clone_ptr() {
76                 long ret = bindings.COption_MonitorEventZ_clone_ptr(this.ptr);
77                 return ret;
78         }
79
80         /**
81          * Creates a new COption_MonitorEventZ which has the same data as `orig`
82          * but with all dynamically-allocated buffers duplicated in new buffers.
83          */
84         public Option_MonitorEventZ clone() {
85                 long ret = bindings.COption_MonitorEventZ_clone(this.ptr);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 Option_MonitorEventZ ret_hu_conv = Option_MonitorEventZ.constr_from_ptr(ret);
88                 ret_hu_conv.ptrs_to.add(this);
89                 return ret_hu_conv;
90         }
91
92 }