]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.java
[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ extends CommonBase {
11         private Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ(Object _dummy, long ptr) { super(ptr); }
12         protected void finalize() throws Throwable {
13                 if (ptr != 0) { bindings.CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(ptr); } super.finalize();
14         }
15
16         protected void force_free() {
17                 if (ptr != 0) { bindings.CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(ptr); ptr = 0; }
18         }
19
20         static Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ constr_from_ptr(long ptr) {
21                 if (bindings.CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(ptr)) {
22                         return new Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_OK(null, ptr);
23                 } else {
24                         return new Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_Err(null, ptr);
25                 }
26         }
27         public static final class Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_OK extends Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
28                 public final InvoiceWithExplicitSigningPubkeyBuilder res;
29                 private Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_OK(Object _dummy, long ptr) {
30                         super(_dummy, ptr);
31                         long res = bindings.CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(ptr);
32                         org.ldk.structs.InvoiceWithExplicitSigningPubkeyBuilder res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.InvoiceWithExplicitSigningPubkeyBuilder(null, res); }
33                         if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); };
34                         this.res = res_hu_conv;
35                 }
36         }
37
38         public static final class Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_Err extends Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ {
39                 public final Bolt12SemanticError err;
40                 private Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_Err(Object _dummy, long ptr) {
41                         super(_dummy, ptr);
42                         this.err = bindings.CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(ptr);
43                 }
44         }
45
46         /**
47          * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state.
48          */
49         public static Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ ok(org.ldk.structs.InvoiceWithExplicitSigningPubkeyBuilder o) {
50                 long ret = bindings.CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o.ptr);
51                 Reference.reachabilityFence(o);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.constr_from_ptr(ret);
54                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); };
55                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
56                 // an object to pass exclusive ownership to the function being called.
57                 // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object
58                 // at the FFI layer, creating a new object which Rust can claim ownership of
59                 // However, in some cases (eg here), there is no way to clone an object, and thus
60                 // we actually have to pass full ownership to Rust.
61                 // Thus, after ret_hu_conv call, o is reset to null and is now a dummy object.
62                 o.ptr = 0;;
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state.
68          */
69         public static Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ err(org.ldk.enums.Bolt12SemanticError e) {
70                 long ret = bindings.CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e);
71                 Reference.reachabilityFence(e);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ.constr_from_ptr(ret);
74                 return ret_hu_conv;
75         }
76
77         /**
78          * Checks if the given object is currently in the success state
79          */
80         public boolean is_ok() {
81                 boolean ret = bindings.CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(this.ptr);
82                 Reference.reachabilityFence(this);
83                 return ret;
84         }
85
86 }