1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
9 public class Result_InvoiceSemanticErrorZ extends CommonBase {
10 private Result_InvoiceSemanticErrorZ(Object _dummy, long ptr) { super(ptr); }
11 protected void finalize() throws Throwable {
12 if (ptr != 0) { bindings.CResult_InvoiceSemanticErrorZ_free(ptr); } super.finalize();
15 static Result_InvoiceSemanticErrorZ constr_from_ptr(long ptr) {
16 if (bindings.CResult_InvoiceSemanticErrorZ_is_ok(ptr)) {
17 return new Result_InvoiceSemanticErrorZ_OK(null, ptr);
19 return new Result_InvoiceSemanticErrorZ_Err(null, ptr);
22 public static final class Result_InvoiceSemanticErrorZ_OK extends Result_InvoiceSemanticErrorZ {
23 public final Invoice res;
24 private Result_InvoiceSemanticErrorZ_OK(Object _dummy, long ptr) {
26 long res = bindings.LDKCResult_InvoiceSemanticErrorZ_get_ok(ptr);
27 Invoice res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new Invoice(null, res); }
28 res_hu_conv.ptrs_to.add(this);
29 this.res = res_hu_conv;
33 public static final class Result_InvoiceSemanticErrorZ_Err extends Result_InvoiceSemanticErrorZ {
34 public final SemanticError err;
35 private Result_InvoiceSemanticErrorZ_Err(Object _dummy, long ptr) {
37 this.err = bindings.LDKCResult_InvoiceSemanticErrorZ_get_err(ptr);
42 * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
44 public static Result_InvoiceSemanticErrorZ ok(Invoice o) {
45 long ret = bindings.CResult_InvoiceSemanticErrorZ_ok(o == null ? 0 : o.ptr & ~1);
46 if (ret >= 0 && ret <= 4096) { return null; }
47 Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret);
52 * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
54 public static Result_InvoiceSemanticErrorZ err(org.ldk.enums.SemanticError e) {
55 long ret = bindings.CResult_InvoiceSemanticErrorZ_err(e);
56 if (ret >= 0 && ret <= 4096) { return null; }
57 Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret);
62 * Checks if the given object is currently in the success state
64 public boolean is_ok() {
65 boolean ret = bindings.CResult_InvoiceSemanticErrorZ_is_ok(this.ptr);
70 long ret = bindings.CResult_InvoiceSemanticErrorZ_clone_ptr(this.ptr);
75 * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
76 * but with all dynamically-allocated buffers duplicated in new buffers.
78 public Result_InvoiceSemanticErrorZ clone() {
79 long ret = bindings.CResult_InvoiceSemanticErrorZ_clone(this.ptr);
80 if (ret >= 0 && ret <= 4096) { return null; }
81 Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret);