[Java] Print error stack trace when tests fail
[ldk-java] / src / main / java / org / ldk / structs / Record.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  * A Record, unit of logging output with Metadata to enable filtering
13  * Module_path, file, line to inform on log's source
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class Record extends CommonBase {
17         Record(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.Record_free(ptr); }
22         }
23
24         /**
25          * The verbosity level of the message.
26          */
27         public Level get_level() {
28                 Level ret = bindings.Record_get_level(this.ptr);
29                 Reference.reachabilityFence(this);
30                 return ret;
31         }
32
33         /**
34          * The verbosity level of the message.
35          */
36         public void set_level(org.ldk.enums.Level val) {
37                 bindings.Record_set_level(this.ptr, val);
38                 Reference.reachabilityFence(this);
39                 Reference.reachabilityFence(val);
40         }
41
42         /**
43          * The node id of the peer pertaining to the logged record.
44          * 
45          * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be
46          * `None`, depending on if the peer information is readily available in LDK when the log is
47          * generated.
48          * 
49          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
50          */
51         @Nullable
52         public byte[] get_peer_id() {
53                 byte[] ret = bindings.Record_get_peer_id(this.ptr);
54                 Reference.reachabilityFence(this);
55                 return ret;
56         }
57
58         /**
59          * The node id of the peer pertaining to the logged record.
60          * 
61          * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be
62          * `None`, depending on if the peer information is readily available in LDK when the log is
63          * generated.
64          * 
65          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
66          */
67         public void set_peer_id(@Nullable byte[] val) {
68                 bindings.Record_set_peer_id(this.ptr, InternalUtils.check_arr_len(val, 33));
69                 Reference.reachabilityFence(this);
70                 Reference.reachabilityFence(val);
71         }
72
73         /**
74          * The channel id of the channel pertaining to the logged record. May be a temporary id before
75          * the channel has been funded.
76          * 
77          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
78          */
79         @Nullable
80         public ChannelId get_channel_id() {
81                 long ret = bindings.Record_get_channel_id(this.ptr);
82                 Reference.reachabilityFence(this);
83                 if (ret >= 0 && ret <= 4096) { return null; }
84                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
85                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
86                 return ret_hu_conv;
87         }
88
89         /**
90          * The channel id of the channel pertaining to the logged record. May be a temporary id before
91          * the channel has been funded.
92          * 
93          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
94          */
95         public void set_channel_id(@Nullable org.ldk.structs.ChannelId val) {
96                 bindings.Record_set_channel_id(this.ptr, val == null ? 0 : val.ptr);
97                 Reference.reachabilityFence(this);
98                 Reference.reachabilityFence(val);
99                 if (this != null) { this.ptrs_to.add(val); };
100         }
101
102         /**
103          * The message body.
104          */
105         public String get_args() {
106                 String ret = bindings.Record_get_args(this.ptr);
107                 Reference.reachabilityFence(this);
108                 return ret;
109         }
110
111         /**
112          * The message body.
113          */
114         public void set_args(java.lang.String val) {
115                 bindings.Record_set_args(this.ptr, val);
116                 Reference.reachabilityFence(this);
117                 Reference.reachabilityFence(val);
118         }
119
120         /**
121          * The module path of the message.
122          */
123         public String get_module_path() {
124                 String ret = bindings.Record_get_module_path(this.ptr);
125                 Reference.reachabilityFence(this);
126                 return ret;
127         }
128
129         /**
130          * The module path of the message.
131          */
132         public void set_module_path(java.lang.String val) {
133                 bindings.Record_set_module_path(this.ptr, val);
134                 Reference.reachabilityFence(this);
135                 Reference.reachabilityFence(val);
136         }
137
138         /**
139          * The source file containing the message.
140          */
141         public String get_file() {
142                 String ret = bindings.Record_get_file(this.ptr);
143                 Reference.reachabilityFence(this);
144                 return ret;
145         }
146
147         /**
148          * The source file containing the message.
149          */
150         public void set_file(java.lang.String val) {
151                 bindings.Record_set_file(this.ptr, val);
152                 Reference.reachabilityFence(this);
153                 Reference.reachabilityFence(val);
154         }
155
156         /**
157          * The line containing the message.
158          */
159         public int get_line() {
160                 int ret = bindings.Record_get_line(this.ptr);
161                 Reference.reachabilityFence(this);
162                 return ret;
163         }
164
165         /**
166          * The line containing the message.
167          */
168         public void set_line(int val) {
169                 bindings.Record_set_line(this.ptr, val);
170                 Reference.reachabilityFence(this);
171                 Reference.reachabilityFence(val);
172         }
173
174         /**
175          * Constructs a new Record given each field
176          * 
177          * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
178          * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
179          */
180         public static Record of(org.ldk.enums.Level level_arg, @Nullable byte[] peer_id_arg, @Nullable org.ldk.structs.ChannelId channel_id_arg, java.lang.String args_arg, java.lang.String module_path_arg, java.lang.String file_arg, int line_arg) {
181                 long ret = bindings.Record_new(level_arg, InternalUtils.check_arr_len(peer_id_arg, 33), channel_id_arg == null ? 0 : channel_id_arg.ptr, args_arg, module_path_arg, file_arg, line_arg);
182                 Reference.reachabilityFence(level_arg);
183                 Reference.reachabilityFence(peer_id_arg);
184                 Reference.reachabilityFence(channel_id_arg);
185                 Reference.reachabilityFence(args_arg);
186                 Reference.reachabilityFence(module_path_arg);
187                 Reference.reachabilityFence(file_arg);
188                 Reference.reachabilityFence(line_arg);
189                 if (ret >= 0 && ret <= 4096) { return null; }
190                 org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); }
191                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
192                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
193                 return ret_hu_conv;
194         }
195
196         long clone_ptr() {
197                 long ret = bindings.Record_clone_ptr(this.ptr);
198                 Reference.reachabilityFence(this);
199                 return ret;
200         }
201
202         /**
203          * Creates a copy of the Record
204          */
205         public Record clone() {
206                 long ret = bindings.Record_clone(this.ptr);
207                 Reference.reachabilityFence(this);
208                 if (ret >= 0 && ret <= 4096) { return null; }
209                 org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); }
210                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
211                 return ret_hu_conv;
212         }
213
214 }