Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Option_TypeZ.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::ln::wire::Type or not
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class Option_TypeZ extends CommonBase {
15         private Option_TypeZ(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_TypeZ_free(ptr); }
20         }
21         static Option_TypeZ constr_from_ptr(long ptr) {
22                 bindings.LDKCOption_TypeZ raw_val = bindings.LDKCOption_TypeZ_ref_from_ptr(ptr);
23                 if (raw_val.getClass() == bindings.LDKCOption_TypeZ.Some.class) {
24                         return new Some(ptr, (bindings.LDKCOption_TypeZ.Some)raw_val);
25                 }
26                 if (raw_val.getClass() == bindings.LDKCOption_TypeZ.None.class) {
27                         return new None(ptr, (bindings.LDKCOption_TypeZ.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_TypeZ contains a crate::lightning::ln::wire::Type
34          */
35         public final static class Some extends Option_TypeZ {
36                 public final Type some;
37                 private Some(long ptr, bindings.LDKCOption_TypeZ.Some obj) {
38                         super(null, ptr);
39                         long some = obj.some;
40                         Type ret_hu_conv = new Type(null, some);
41                         ret_hu_conv.ptrs_to.add(this);
42                         this.some = ret_hu_conv;
43                 }
44         }
45         /**
46          * When we're in this state, this COption_TypeZ contains nothing
47          */
48         public final static class None extends Option_TypeZ {
49                 private None(long ptr, bindings.LDKCOption_TypeZ.None obj) {
50                         super(null, ptr);
51                 }
52         }
53         /**
54          * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
55          */
56         public static Option_TypeZ some(Type o) {
57                 long ret = bindings.COption_TypeZ_some(o == null ? 0 : o.ptr);
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
60                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
61                 ret_hu_conv.ptrs_to.add(o);
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Constructs a new COption_TypeZ containing nothing
67          */
68         public static Option_TypeZ none() {
69                 long ret = bindings.COption_TypeZ_none();
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
72                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
73                 return ret_hu_conv;
74         }
75
76         long clone_ptr() {
77                 long ret = bindings.COption_TypeZ_clone_ptr(this.ptr);
78                 return ret;
79         }
80
81         /**
82          * Creates a new COption_TypeZ which has the same data as `orig`
83          * but with all dynamically-allocated buffers duplicated in new buffers.
84          */
85         public Option_TypeZ clone() {
86                 long ret = bindings.COption_TypeZ_clone(this.ptr);
87                 if (ret >= 0 && ret <= 4096) { return null; }
88                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
89                 ret_hu_conv.ptrs_to.add(this);
90                 return ret_hu_conv;
91         }
92
93 }