Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / ChannelUpdate.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
8
9 /**
10  * A channel_update message to be sent or received from a peer
11  */
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class ChannelUpdate extends CommonBase {
14         ChannelUpdate(Object _dummy, long ptr) { super(ptr); }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 super.finalize();
18                 if (ptr != 0) { bindings.ChannelUpdate_free(ptr); }
19         }
20
21         /**
22          * A signature of the channel update
23          */
24         public byte[] get_signature() {
25                 byte[] ret = bindings.ChannelUpdate_get_signature(this.ptr);
26                 return ret;
27         }
28
29         /**
30          * A signature of the channel update
31          */
32         public void set_signature(byte[] val) {
33                 bindings.ChannelUpdate_set_signature(this.ptr, val);
34         }
35
36         /**
37          * The actual channel update
38          */
39         public UnsignedChannelUpdate get_contents() {
40                 long ret = bindings.ChannelUpdate_get_contents(this.ptr);
41                 UnsignedChannelUpdate ret_hu_conv = new UnsignedChannelUpdate(null, ret);
42                 ret_hu_conv.ptrs_to.add(this);
43                 return ret_hu_conv;
44         }
45
46         /**
47          * The actual channel update
48          */
49         public void set_contents(UnsignedChannelUpdate val) {
50                 bindings.ChannelUpdate_set_contents(this.ptr, val == null ? 0 : val.ptr & ~1);
51                 this.ptrs_to.add(val);
52         }
53
54         /**
55          * Constructs a new ChannelUpdate given each field
56          */
57         public static ChannelUpdate of(byte[] signature_arg, UnsignedChannelUpdate contents_arg) {
58                 long ret = bindings.ChannelUpdate_new(signature_arg, contents_arg == null ? 0 : contents_arg.ptr & ~1);
59                 ChannelUpdate ret_hu_conv = new ChannelUpdate(null, ret);
60                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
61                 ret_hu_conv.ptrs_to.add(contents_arg);
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Creates a copy of the ChannelUpdate
67          */
68         public ChannelUpdate clone() {
69                 long ret = bindings.ChannelUpdate_clone(this.ptr);
70                 ChannelUpdate ret_hu_conv = new ChannelUpdate(null, ret);
71                 ret_hu_conv.ptrs_to.add(this);
72                 return ret_hu_conv;
73         }
74
75         /**
76          * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
77          */
78         public byte[] write() {
79                 byte[] ret = bindings.ChannelUpdate_write(this.ptr);
80                 return ret;
81         }
82
83         /**
84          * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
85          */
86         public static Result_ChannelUpdateDecodeErrorZ read(byte[] ser) {
87                 long ret = bindings.ChannelUpdate_read(ser);
88                 Result_ChannelUpdateDecodeErrorZ ret_hu_conv = Result_ChannelUpdateDecodeErrorZ.constr_from_ptr(ret);
89                 return ret_hu_conv;
90         }
91
92 }