Merge pull request #33 from TheBlueMatt/main
[ldk-java] / src / main / java / org / ldk / structs / Result_SignedRawInvoiceNoneZ.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 public class Result_SignedRawInvoiceNoneZ extends CommonBase {
10         private Result_SignedRawInvoiceNoneZ(Object _dummy, long ptr) { super(ptr); }
11         protected void finalize() throws Throwable {
12                 if (ptr != 0) { bindings.CResult_SignedRawInvoiceNoneZ_free(ptr); } super.finalize();
13         }
14
15         static Result_SignedRawInvoiceNoneZ constr_from_ptr(long ptr) {
16                 if (bindings.LDKCResult_SignedRawInvoiceNoneZ_result_ok(ptr)) {
17                         return new Result_SignedRawInvoiceNoneZ_OK(null, ptr);
18                 } else {
19                         return new Result_SignedRawInvoiceNoneZ_Err(null, ptr);
20                 }
21         }
22         public static final class Result_SignedRawInvoiceNoneZ_OK extends Result_SignedRawInvoiceNoneZ {
23                 public final SignedRawInvoice res;
24                 private Result_SignedRawInvoiceNoneZ_OK(Object _dummy, long ptr) {
25                         super(_dummy, ptr);
26                         long res = bindings.LDKCResult_SignedRawInvoiceNoneZ_get_ok(ptr);
27                         SignedRawInvoice res_hu_conv = new SignedRawInvoice(null, res);
28                         res_hu_conv.ptrs_to.add(this);
29                         this.res = res_hu_conv;
30                 }
31         }
32
33         public static final class Result_SignedRawInvoiceNoneZ_Err extends Result_SignedRawInvoiceNoneZ {
34                 private Result_SignedRawInvoiceNoneZ_Err(Object _dummy, long ptr) {
35                         super(_dummy, ptr);
36                 }
37         }
38
39         /**
40          * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
41          */
42         public static Result_SignedRawInvoiceNoneZ ok(SignedRawInvoice o) {
43                 long ret = bindings.CResult_SignedRawInvoiceNoneZ_ok(o == null ? 0 : o.ptr & ~1);
44                 if (ret < 1024) { return null; }
45                 Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret);
46                 ret_hu_conv.ptrs_to.add(o);
47                 return ret_hu_conv;
48         }
49
50         /**
51          * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
52          */
53         public static Result_SignedRawInvoiceNoneZ err() {
54                 long ret = bindings.CResult_SignedRawInvoiceNoneZ_err();
55                 if (ret < 1024) { return null; }
56                 Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret);
57                 return ret_hu_conv;
58         }
59
60         /**
61          * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
62          * but with all dynamically-allocated buffers duplicated in new buffers.
63          */
64         public Result_SignedRawInvoiceNoneZ clone() {
65                 long ret = bindings.CResult_SignedRawInvoiceNoneZ_clone(this.ptr);
66                 if (ret < 1024) { return null; }
67                 Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret);
68                 return ret_hu_conv;
69         }
70
71 }