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 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); };
87 * The channel id of the channel pertaining to the logged record. May be a temporary id before
88 * the channel has been funded.
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); };
100 public String get_args() {
101 String ret = bindings.Record_get_args(this.ptr);
102 Reference.reachabilityFence(this);
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);
116 * The module path of the message.
118 public String get_module_path() {
119 String ret = bindings.Record_get_module_path(this.ptr);
120 Reference.reachabilityFence(this);
125 * The module path of the message.
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);
134 * The source file containing the message.
136 public String get_file() {
137 String ret = bindings.Record_get_file(this.ptr);
138 Reference.reachabilityFence(this);
143 * The source file containing the message.
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);
152 * The line containing the message.
154 public int get_line() {
155 int ret = bindings.Record_get_line(this.ptr);
156 Reference.reachabilityFence(this);
161 * The line containing the message.
163 public void set_line(int val) {
164 bindings.Record_set_line(this.ptr, val);
165 Reference.reachabilityFence(this);
166 Reference.reachabilityFence(val);
170 * Constructs a new Record given each field
172 * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
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); };
191 long ret = bindings.Record_clone_ptr(this.ptr);
192 Reference.reachabilityFence(this);
197 * Creates a copy of the Record
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); };