[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / GraphSyncError.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
11 /**
12  * All-encompassing standard error type that processing can return
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class GraphSyncError extends CommonBase {
16         private GraphSyncError(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.GraphSyncError_free(ptr); }
21         }
22         static GraphSyncError constr_from_ptr(long ptr) {
23                 bindings.LDKGraphSyncError raw_val = bindings.LDKGraphSyncError_ref_from_ptr(ptr);
24                 if (raw_val.getClass() == bindings.LDKGraphSyncError.DecodeError.class) {
25                         return new DecodeError(ptr, (bindings.LDKGraphSyncError.DecodeError)raw_val);
26                 }
27                 if (raw_val.getClass() == bindings.LDKGraphSyncError.LightningError.class) {
28                         return new LightningError(ptr, (bindings.LDKGraphSyncError.LightningError)raw_val);
29                 }
30                 assert false; return null; // Unreachable without extending the (internal) bindings interface
31         }
32
33         /**
34          * Error trying to read the update data, typically due to an erroneous data length indication
35          * that is greater than the actual amount of data provided
36          */
37         public final static class DecodeError extends GraphSyncError {
38                 public final org.ldk.structs.DecodeError decode_error;
39                 private DecodeError(long ptr, bindings.LDKGraphSyncError.DecodeError obj) {
40                         super(null, ptr);
41                         long decode_error = obj.decode_error;
42                         org.ldk.structs.DecodeError decode_error_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(decode_error);
43                         if (decode_error_hu_conv != null) { decode_error_hu_conv.ptrs_to.add(this); };
44                         this.decode_error = decode_error_hu_conv;
45                 }
46         }
47         /**
48          * Error applying the patch to the network graph, usually the result of updates that are too
49          * old or missing prerequisite data to the application of updates out of order
50          */
51         public final static class LightningError extends GraphSyncError {
52                 public final org.ldk.structs.LightningError lightning_error;
53                 private LightningError(long ptr, bindings.LDKGraphSyncError.LightningError obj) {
54                         super(null, ptr);
55                         long lightning_error = obj.lightning_error;
56                         org.ldk.structs.LightningError lightning_error_hu_conv = null; if (lightning_error < 0 || lightning_error > 4096) { lightning_error_hu_conv = new org.ldk.structs.LightningError(null, lightning_error); }
57                         if (lightning_error_hu_conv != null) { lightning_error_hu_conv.ptrs_to.add(this); };
58                         this.lightning_error = lightning_error_hu_conv;
59                 }
60         }
61         long clone_ptr() {
62                 long ret = bindings.GraphSyncError_clone_ptr(this.ptr);
63                 Reference.reachabilityFence(this);
64                 return ret;
65         }
66
67         /**
68          * Creates a copy of the GraphSyncError
69          */
70         public GraphSyncError clone() {
71                 long ret = bindings.GraphSyncError_clone(this.ptr);
72                 Reference.reachabilityFence(this);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 org.ldk.structs.GraphSyncError ret_hu_conv = org.ldk.structs.GraphSyncError.constr_from_ptr(ret);
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
76                 return ret_hu_conv;
77         }
78
79         /**
80          * Utility method to constructs a new DecodeError-variant GraphSyncError
81          */
82         public static GraphSyncError decode_error(org.ldk.structs.DecodeError a) {
83                 long ret = bindings.GraphSyncError_decode_error(a.ptr);
84                 Reference.reachabilityFence(a);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 org.ldk.structs.GraphSyncError ret_hu_conv = org.ldk.structs.GraphSyncError.constr_from_ptr(ret);
87                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
88                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
89                 return ret_hu_conv;
90         }
91
92         /**
93          * Utility method to constructs a new LightningError-variant GraphSyncError
94          */
95         public static GraphSyncError lightning_error(org.ldk.structs.LightningError a) {
96                 long ret = bindings.GraphSyncError_lightning_error(a == null ? 0 : a.ptr);
97                 Reference.reachabilityFence(a);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 org.ldk.structs.GraphSyncError ret_hu_conv = org.ldk.structs.GraphSyncError.constr_from_ptr(ret);
100                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
101                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
102                 return ret_hu_conv;
103         }
104
105 }