Update auto-generated bindings to 0.0.103
[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         public final static class Some extends Option_TypeZ {
33                 public final Type some;
34                 private Some(long ptr, bindings.LDKCOption_TypeZ.Some obj) {
35                         super(null, ptr);
36                         long some = obj.some;
37                         Type ret_hu_conv = new Type(null, some);
38                         ret_hu_conv.ptrs_to.add(this);
39                         this.some = ret_hu_conv;
40                 }
41         }
42         public final static class None extends Option_TypeZ {
43                 private None(long ptr, bindings.LDKCOption_TypeZ.None obj) {
44                         super(null, ptr);
45                 }
46         }
47         /**
48          * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
49          */
50         public static Option_TypeZ some(Type o) {
51                 long ret = bindings.COption_TypeZ_some(o == null ? 0 : o.ptr);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
54                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
55                 ret_hu_conv.ptrs_to.add(o);
56                 return ret_hu_conv;
57         }
58
59         /**
60          * Constructs a new COption_TypeZ containing nothing
61          */
62         public static Option_TypeZ none() {
63                 long ret = bindings.COption_TypeZ_none();
64                 if (ret >= 0 && ret <= 4096) { return null; }
65                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
66                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
67                 return ret_hu_conv;
68         }
69
70         /**
71          * Creates a new COption_TypeZ which has the same data as `orig`
72          * but with all dynamically-allocated buffers duplicated in new buffers.
73          */
74         public Option_TypeZ clone() {
75                 long ret = bindings.COption_TypeZ_clone(this.ptr);
76                 if (ret >= 0 && ret <= 4096) { return null; }
77                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
78                 ret_hu_conv.ptrs_to.add(this);
79                 return ret_hu_conv;
80         }
81
82 }