1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A Record, unit of logging output with Metadata to enable filtering
13 * Module_path, file, line to inform on log's source
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 {
21 if (ptr != 0) { bindings.Record_free(ptr); }
25 * The verbosity level of the message.
27 public Level get_level() {
28 Level ret = bindings.Record_get_level(this.ptr);
29 Reference.reachabilityFence(this);
34 * The verbosity level of the message.
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);
43 * The node id of the peer pertaining to the logged record.
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
49 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
52 public byte[] get_peer_id() {
53 byte[] ret = bindings.Record_get_peer_id(this.ptr);
54 Reference.reachabilityFence(this);
59 * The node id of the peer pertaining to the logged record.
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
65 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
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);
74 * The channel id of the channel pertaining to the logged record. May be a temporary id before
75 * the channel has been funded.
77 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
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); };
90 * The channel id of the channel pertaining to the logged record. May be a temporary id before
91 * the channel has been funded.
93 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
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); };
105 public String get_args() {
106 String ret = bindings.Record_get_args(this.ptr);
107 Reference.reachabilityFence(this);
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);
121 * The module path of the message.
123 public String get_module_path() {
124 String ret = bindings.Record_get_module_path(this.ptr);
125 Reference.reachabilityFence(this);
130 * The module path of the message.
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);
139 * The source file containing the message.
141 public String get_file() {
142 String ret = bindings.Record_get_file(this.ptr);
143 Reference.reachabilityFence(this);
148 * The source file containing the message.
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);
157 * The line containing the message.
159 public int get_line() {
160 int ret = bindings.Record_get_line(this.ptr);
161 Reference.reachabilityFence(this);
166 * The line containing the message.
168 public void set_line(int val) {
169 bindings.Record_set_line(this.ptr, val);
170 Reference.reachabilityFence(this);
171 Reference.reachabilityFence(val);
175 * Constructs a new Record given each field
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
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); };
197 long ret = bindings.Record_clone_ptr(this.ptr);
198 Reference.reachabilityFence(this);
203 * Creates a copy of the Record
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); };