Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / SignOrCreationError.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
8
9 /**
10  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
11  * may occur.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class SignOrCreationError extends CommonBase {
15         private SignOrCreationError(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.SignOrCreationError_free(ptr); }
20         }
21         static SignOrCreationError constr_from_ptr(long ptr) {
22                 bindings.LDKSignOrCreationError raw_val = bindings.LDKSignOrCreationError_ref_from_ptr(ptr);
23                 if (raw_val.getClass() == bindings.LDKSignOrCreationError.SignError.class) {
24                         return new SignError(ptr, (bindings.LDKSignOrCreationError.SignError)raw_val);
25                 }
26                 if (raw_val.getClass() == bindings.LDKSignOrCreationError.CreationError.class) {
27                         return new CreationError(ptr, (bindings.LDKSignOrCreationError.CreationError)raw_val);
28                 }
29                 assert false; return null; // Unreachable without extending the (internal) bindings interface
30         }
31
32         public final static class SignError extends SignOrCreationError {
33                 private SignError(long ptr, bindings.LDKSignOrCreationError.SignError obj) {
34                         super(null, ptr);
35                 }
36         }
37         public final static class CreationError extends SignOrCreationError {
38                 public final org.ldk.enums.CreationError creation_error;
39                 private CreationError(long ptr, bindings.LDKSignOrCreationError.CreationError obj) {
40                         super(null, ptr);
41                         this.creation_error = obj.creation_error;
42                 }
43         }
44         /**
45          * Creates a copy of the SignOrCreationError
46          */
47         public SignOrCreationError clone() {
48                 long ret = bindings.SignOrCreationError_clone(this.ptr);
49                 SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret);
50                 ret_hu_conv.ptrs_to.add(this);
51                 return ret_hu_conv;
52         }
53
54         /**
55          * Checks if two SignOrCreationErrors contain equal inner contents.
56          * This ignores pointers and is_owned flags and looks at the values in fields.
57          */
58         public boolean eq(SignOrCreationError b) {
59                 boolean ret = bindings.SignOrCreationError_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
60                 this.ptrs_to.add(b);
61                 return ret;
62         }
63
64         /**
65          * Get the string representation of a SignOrCreationError object
66          */
67         public String to_str() {
68                 String ret = bindings.SignOrCreationError_to_str(this.ptr);
69                 return ret;
70         }
71
72 }