[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / InboundHTLCErr.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  * Invalid inbound onion payment.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class InboundHTLCErr extends CommonBase {
16         InboundHTLCErr(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.InboundHTLCErr_free(ptr); }
21         }
22
23         /**
24          * BOLT 4 error code.
25          */
26         public short get_err_code() {
27                 short ret = bindings.InboundHTLCErr_get_err_code(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * BOLT 4 error code.
34          */
35         public void set_err_code(short val) {
36                 bindings.InboundHTLCErr_set_err_code(this.ptr, val);
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * Data attached to this error.
43          * 
44          * Returns a copy of the field.
45          */
46         public byte[] get_err_data() {
47                 byte[] ret = bindings.InboundHTLCErr_get_err_data(this.ptr);
48                 Reference.reachabilityFence(this);
49                 return ret;
50         }
51
52         /**
53          * Data attached to this error.
54          */
55         public void set_err_data(byte[] val) {
56                 bindings.InboundHTLCErr_set_err_data(this.ptr, val);
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         /**
62          * Error message text.
63          */
64         public String get_msg() {
65                 String ret = bindings.InboundHTLCErr_get_msg(this.ptr);
66                 Reference.reachabilityFence(this);
67                 return ret;
68         }
69
70         /**
71          * Error message text.
72          */
73         public void set_msg(java.lang.String val) {
74                 bindings.InboundHTLCErr_set_msg(this.ptr, val);
75                 Reference.reachabilityFence(this);
76                 Reference.reachabilityFence(val);
77         }
78
79         /**
80          * Constructs a new InboundHTLCErr given each field
81          */
82         public static InboundHTLCErr of(short err_code_arg, byte[] err_data_arg, java.lang.String msg_arg) {
83                 long ret = bindings.InboundHTLCErr_new(err_code_arg, err_data_arg, msg_arg);
84                 Reference.reachabilityFence(err_code_arg);
85                 Reference.reachabilityFence(err_data_arg);
86                 Reference.reachabilityFence(msg_arg);
87                 if (ret >= 0 && ret <= 4096) { return null; }
88                 org.ldk.structs.InboundHTLCErr ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InboundHTLCErr(null, ret); }
89                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
90                 return ret_hu_conv;
91         }
92
93         long clone_ptr() {
94                 long ret = bindings.InboundHTLCErr_clone_ptr(this.ptr);
95                 Reference.reachabilityFence(this);
96                 return ret;
97         }
98
99         /**
100          * Creates a copy of the InboundHTLCErr
101          */
102         public InboundHTLCErr clone() {
103                 long ret = bindings.InboundHTLCErr_clone(this.ptr);
104                 Reference.reachabilityFence(this);
105                 if (ret >= 0 && ret <= 4096) { return null; }
106                 org.ldk.structs.InboundHTLCErr ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InboundHTLCErr(null, ret); }
107                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
108                 return ret_hu_conv;
109         }
110
111         /**
112          * Generates a non-cryptographic 64-bit hash of the InboundHTLCErr.
113          */
114         public long hash() {
115                 long ret = bindings.InboundHTLCErr_hash(this.ptr);
116                 Reference.reachabilityFence(this);
117                 return ret;
118         }
119
120         @Override public int hashCode() {
121                 return (int)this.hash();
122         }
123         /**
124          * Checks if two InboundHTLCErrs contain equal inner contents.
125          * This ignores pointers and is_owned flags and looks at the values in fields.
126          * Two objects with NULL inner values will be considered "equal" here.
127          */
128         public boolean eq(org.ldk.structs.InboundHTLCErr b) {
129                 boolean ret = bindings.InboundHTLCErr_eq(this.ptr, b.ptr);
130                 Reference.reachabilityFence(this);
131                 Reference.reachabilityFence(b);
132                 if (this != null) { this.ptrs_to.add(b); };
133                 return ret;
134         }
135
136         @Override public boolean equals(Object o) {
137                 if (!(o instanceof InboundHTLCErr)) return false;
138                 return this.eq((InboundHTLCErr)o);
139         }
140 }