]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java
Merge pull request #69 from TheBlueMatt/main
[ldk-java] / src / main / java / org / ldk / structs / Result_InvoiceNoneZ.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 java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10 public class Result_InvoiceNoneZ extends CommonBase {
11         private Result_InvoiceNoneZ(Object _dummy, long ptr) { super(ptr); }
12         protected void finalize() throws Throwable {
13                 if (ptr != 0) { bindings.CResult_InvoiceNoneZ_free(ptr); } super.finalize();
14         }
15
16         static Result_InvoiceNoneZ constr_from_ptr(long ptr) {
17                 if (bindings.CResult_InvoiceNoneZ_is_ok(ptr)) {
18                         return new Result_InvoiceNoneZ_OK(null, ptr);
19                 } else {
20                         return new Result_InvoiceNoneZ_Err(null, ptr);
21                 }
22         }
23         public static final class Result_InvoiceNoneZ_OK extends Result_InvoiceNoneZ {
24                 public final Invoice res;
25                 private Result_InvoiceNoneZ_OK(Object _dummy, long ptr) {
26                         super(_dummy, ptr);
27                         long res = bindings.LDKCResult_InvoiceNoneZ_get_ok(ptr);
28                         Invoice res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new Invoice(null, res); }
29                         res_hu_conv.ptrs_to.add(this);
30                         this.res = res_hu_conv;
31                 }
32         }
33
34         public static final class Result_InvoiceNoneZ_Err extends Result_InvoiceNoneZ {
35                 private Result_InvoiceNoneZ_Err(Object _dummy, long ptr) {
36                         super(_dummy, ptr);
37                 }
38         }
39
40         /**
41          * Creates a new CResult_InvoiceNoneZ in the success state.
42          */
43         public static Result_InvoiceNoneZ ok(Invoice o) {
44                 long ret = bindings.CResult_InvoiceNoneZ_ok(o == null ? 0 : o.ptr & ~1);
45                 Reference.reachabilityFence(o);
46                 if (ret >= 0 && ret <= 4096) { return null; }
47                 Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret);
48                 return ret_hu_conv;
49         }
50
51         /**
52          * Creates a new CResult_InvoiceNoneZ in the error state.
53          */
54         public static Result_InvoiceNoneZ err() {
55                 long ret = bindings.CResult_InvoiceNoneZ_err();
56                 if (ret >= 0 && ret <= 4096) { return null; }
57                 Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret);
58                 return ret_hu_conv;
59         }
60
61         /**
62          * Checks if the given object is currently in the success state
63          */
64         public boolean is_ok() {
65                 boolean ret = bindings.CResult_InvoiceNoneZ_is_ok(this.ptr);
66                 Reference.reachabilityFence(this);
67                 return ret;
68         }
69
70         long clone_ptr() {
71                 long ret = bindings.CResult_InvoiceNoneZ_clone_ptr(this.ptr);
72                 Reference.reachabilityFence(this);
73                 return ret;
74         }
75
76         /**
77          * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
78          * but with all dynamically-allocated buffers duplicated in new buffers.
79          */
80         public Result_InvoiceNoneZ clone() {
81                 long ret = bindings.CResult_InvoiceNoneZ_clone(this.ptr);
82                 Reference.reachabilityFence(this);
83                 if (ret >= 0 && ret <= 4096) { return null; }
84                 Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret);
85                 return ret_hu_conv;
86         }
87
88 }