[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / TransactionU16LenLimited.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 wrapper for a `Transaction` which can only be constructed with [`TransactionU16LenLimited::new`]
13  * if the `Transaction`'s consensus-serialized length is <= u16::MAX.
14  * 
15  * Use [`TransactionU16LenLimited::into_transaction`] to convert into the contained `Transaction`.
16  */
17 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class TransactionU16LenLimited extends CommonBase {
19         TransactionU16LenLimited(Object _dummy, long ptr) { super(ptr); }
20         @Override @SuppressWarnings("deprecation")
21         protected void finalize() throws Throwable {
22                 super.finalize();
23                 if (ptr != 0) { bindings.TransactionU16LenLimited_free(ptr); }
24         }
25
26         long clone_ptr() {
27                 long ret = bindings.TransactionU16LenLimited_clone_ptr(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * Creates a copy of the TransactionU16LenLimited
34          */
35         public TransactionU16LenLimited clone() {
36                 long ret = bindings.TransactionU16LenLimited_clone(this.ptr);
37                 Reference.reachabilityFence(this);
38                 if (ret >= 0 && ret <= 4096) { return null; }
39                 org.ldk.structs.TransactionU16LenLimited ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TransactionU16LenLimited(null, ret); }
40                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
41                 return ret_hu_conv;
42         }
43
44         /**
45          * Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited.
46          */
47         public long hash() {
48                 long ret = bindings.TransactionU16LenLimited_hash(this.ptr);
49                 Reference.reachabilityFence(this);
50                 return ret;
51         }
52
53         @Override public int hashCode() {
54                 return (int)this.hash();
55         }
56         /**
57          * Checks if two TransactionU16LenLimiteds contain equal inner contents.
58          * This ignores pointers and is_owned flags and looks at the values in fields.
59          * Two objects with NULL inner values will be considered "equal" here.
60          */
61         public boolean eq(org.ldk.structs.TransactionU16LenLimited b) {
62                 boolean ret = bindings.TransactionU16LenLimited_eq(this.ptr, b == null ? 0 : b.ptr);
63                 Reference.reachabilityFence(this);
64                 Reference.reachabilityFence(b);
65                 if (this != null) { this.ptrs_to.add(b); };
66                 return ret;
67         }
68
69         @Override public boolean equals(Object o) {
70                 if (!(o instanceof TransactionU16LenLimited)) return false;
71                 return this.eq((TransactionU16LenLimited)o);
72         }
73         /**
74          * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus-
75          * serialized length is <= u16::MAX.
76          */
77         public static Result_TransactionU16LenLimitedNoneZ of(byte[] transaction) {
78                 long ret = bindings.TransactionU16LenLimited_new(transaction);
79                 Reference.reachabilityFence(transaction);
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 Result_TransactionU16LenLimitedNoneZ ret_hu_conv = Result_TransactionU16LenLimitedNoneZ.constr_from_ptr(ret);
82                 return ret_hu_conv;
83         }
84
85         /**
86          * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`.
87          */
88         public byte[] into_transaction() {
89                 byte[] ret = bindings.TransactionU16LenLimited_into_transaction(this.ptr);
90                 Reference.reachabilityFence(this);
91                 if (this != null) { this.ptrs_to.add(this); };
92                 return ret;
93         }
94
95         /**
96          * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read
97          */
98         public byte[] write() {
99                 byte[] ret = bindings.TransactionU16LenLimited_write(this.ptr);
100                 Reference.reachabilityFence(this);
101                 return ret;
102         }
103
104         /**
105          * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write
106          */
107         public static Result_TransactionU16LenLimitedDecodeErrorZ read(byte[] ser) {
108                 long ret = bindings.TransactionU16LenLimited_read(ser);
109                 Reference.reachabilityFence(ser);
110                 if (ret >= 0 && ret <= 4096) { return null; }
111                 Result_TransactionU16LenLimitedDecodeErrorZ ret_hu_conv = Result_TransactionU16LenLimitedDecodeErrorZ.constr_from_ptr(ret);
112                 return ret_hu_conv;
113         }
114
115 }