[Java] Update auto-generated Java bindings for 0.0.113
[ldk-java] / src / main / java / org / ldk / structs / NodeAlias.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 user-defined name for a node, which may be used when displaying the node in a graph.
13  * 
14  * Since node aliases are provided by third parties, they are a potential avenue for injection
15  * attacks. Care must be taken when processing.
16  */
17 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class NodeAlias extends CommonBase {
19         NodeAlias(Object _dummy, long ptr) { super(ptr); }
20         @Override @SuppressWarnings("deprecation")
21         protected void finalize() throws Throwable {
22                 super.finalize();
23                 if (ptr != 0) { bindings.NodeAlias_free(ptr); }
24         }
25
26         public byte[] get_a() {
27                 byte[] ret = bindings.NodeAlias_get_a(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         public void set_a(byte[] val) {
33                 bindings.NodeAlias_set_a(this.ptr, InternalUtils.check_arr_len(val, 32));
34                 Reference.reachabilityFence(this);
35                 Reference.reachabilityFence(val);
36         }
37
38         /**
39          * Constructs a new NodeAlias given each field
40          */
41         public static NodeAlias of(byte[] a_arg) {
42                 long ret = bindings.NodeAlias_new(InternalUtils.check_arr_len(a_arg, 32));
43                 Reference.reachabilityFence(a_arg);
44                 if (ret >= 0 && ret <= 4096) { return null; }
45                 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
46                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
47                 return ret_hu_conv;
48         }
49
50         long clone_ptr() {
51                 long ret = bindings.NodeAlias_clone_ptr(this.ptr);
52                 Reference.reachabilityFence(this);
53                 return ret;
54         }
55
56         /**
57          * Creates a copy of the NodeAlias
58          */
59         public NodeAlias clone() {
60                 long ret = bindings.NodeAlias_clone(this.ptr);
61                 Reference.reachabilityFence(this);
62                 if (ret >= 0 && ret <= 4096) { return null; }
63                 org.ldk.structs.NodeAlias ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeAlias(null, ret); }
64                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
65                 return ret_hu_conv;
66         }
67
68         /**
69          * Checks if two NodeAliass contain equal inner contents.
70          * This ignores pointers and is_owned flags and looks at the values in fields.
71          * Two objects with NULL inner values will be considered "equal" here.
72          */
73         public boolean eq(org.ldk.structs.NodeAlias b) {
74                 boolean ret = bindings.NodeAlias_eq(this.ptr, b == null ? 0 : b.ptr);
75                 Reference.reachabilityFence(this);
76                 Reference.reachabilityFence(b);
77                 if (this != null) { this.ptrs_to.add(b); };
78                 return ret;
79         }
80
81         @Override public boolean equals(Object o) {
82                 if (!(o instanceof NodeAlias)) return false;
83                 return this.eq((NodeAlias)o);
84         }
85         /**
86          * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
87          */
88         public byte[] write() {
89                 byte[] ret = bindings.NodeAlias_write(this.ptr);
90                 Reference.reachabilityFence(this);
91                 return ret;
92         }
93
94         /**
95          * Read a NodeAlias from a byte array, created by NodeAlias_write
96          */
97         public static Result_NodeAliasDecodeErrorZ read(byte[] ser) {
98                 long ret = bindings.NodeAlias_read(ser);
99                 Reference.reachabilityFence(ser);
100                 if (ret >= 0 && ret <= 4096) { return null; }
101                 Result_NodeAliasDecodeErrorZ ret_hu_conv = Result_NodeAliasDecodeErrorZ.constr_from_ptr(ret);
102                 return ret_hu_conv;
103         }
104
105 }