[Java] Update auto-generated Java bindings to LDK 0.0.121
[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         public Option_ThirtyTwoBytesZ get_channel_id() {
78                 long ret = bindings.Record_get_channel_id(this.ptr);
79                 Reference.reachabilityFence(this);
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
82                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
83                 return ret_hu_conv;
84         }
85
86         /**
87          * The channel id of the channel pertaining to the logged record. May be a temporary id before
88          * the channel has been funded.
89          */
90         public void set_channel_id(org.ldk.structs.Option_ThirtyTwoBytesZ val) {
91                 bindings.Record_set_channel_id(this.ptr, val.ptr);
92                 Reference.reachabilityFence(this);
93                 Reference.reachabilityFence(val);
94                 if (this != null) { this.ptrs_to.add(val); };
95         }
96
97         /**
98          * The message body.
99          */
100         public String get_args() {
101                 String ret = bindings.Record_get_args(this.ptr);
102                 Reference.reachabilityFence(this);
103                 return ret;
104         }
105
106         /**
107          * The message body.
108          */
109         public void set_args(java.lang.String val) {
110                 bindings.Record_set_args(this.ptr, val);
111                 Reference.reachabilityFence(this);
112                 Reference.reachabilityFence(val);
113         }
114
115         /**
116          * The module path of the message.
117          */
118         public String get_module_path() {
119                 String ret = bindings.Record_get_module_path(this.ptr);
120                 Reference.reachabilityFence(this);
121                 return ret;
122         }
123
124         /**
125          * The module path of the message.
126          */
127         public void set_module_path(java.lang.String val) {
128                 bindings.Record_set_module_path(this.ptr, val);
129                 Reference.reachabilityFence(this);
130                 Reference.reachabilityFence(val);
131         }
132
133         /**
134          * The source file containing the message.
135          */
136         public String get_file() {
137                 String ret = bindings.Record_get_file(this.ptr);
138                 Reference.reachabilityFence(this);
139                 return ret;
140         }
141
142         /**
143          * The source file containing the message.
144          */
145         public void set_file(java.lang.String val) {
146                 bindings.Record_set_file(this.ptr, val);
147                 Reference.reachabilityFence(this);
148                 Reference.reachabilityFence(val);
149         }
150
151         /**
152          * The line containing the message.
153          */
154         public int get_line() {
155                 int ret = bindings.Record_get_line(this.ptr);
156                 Reference.reachabilityFence(this);
157                 return ret;
158         }
159
160         /**
161          * The line containing the message.
162          */
163         public void set_line(int val) {
164                 bindings.Record_set_line(this.ptr, val);
165                 Reference.reachabilityFence(this);
166                 Reference.reachabilityFence(val);
167         }
168
169         /**
170          * Constructs a new Record given each field
171          * 
172          * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
173          */
174         public static Record of(org.ldk.enums.Level level_arg, @Nullable byte[] peer_id_arg, org.ldk.structs.Option_ThirtyTwoBytesZ channel_id_arg, java.lang.String args_arg, java.lang.String module_path_arg, java.lang.String file_arg, int line_arg) {
175                 long ret = bindings.Record_new(level_arg, InternalUtils.check_arr_len(peer_id_arg, 33), channel_id_arg.ptr, args_arg, module_path_arg, file_arg, line_arg);
176                 Reference.reachabilityFence(level_arg);
177                 Reference.reachabilityFence(peer_id_arg);
178                 Reference.reachabilityFence(channel_id_arg);
179                 Reference.reachabilityFence(args_arg);
180                 Reference.reachabilityFence(module_path_arg);
181                 Reference.reachabilityFence(file_arg);
182                 Reference.reachabilityFence(line_arg);
183                 if (ret >= 0 && ret <= 4096) { return null; }
184                 org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); }
185                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
186                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
187                 return ret_hu_conv;
188         }
189
190         long clone_ptr() {
191                 long ret = bindings.Record_clone_ptr(this.ptr);
192                 Reference.reachabilityFence(this);
193                 return ret;
194         }
195
196         /**
197          * Creates a copy of the Record
198          */
199         public Record clone() {
200                 long ret = bindings.Record_clone(this.ptr);
201                 Reference.reachabilityFence(this);
202                 if (ret >= 0 && ret <= 4096) { return null; }
203                 org.ldk.structs.Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Record(null, ret); }
204                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
205                 return ret_hu_conv;
206         }
207
208 }