1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * A payment identifier used to uniquely identify a payment to LDK.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class PaymentId extends CommonBase {
15 PaymentId(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.PaymentId_free(ptr); }
23 * Checks if two PaymentIds contain equal inner contents.
26 long ret = bindings.PaymentId_hash(this.ptr);
31 * Creates a copy of the PaymentId
33 public PaymentId clone() {
34 long ret = bindings.PaymentId_clone(this.ptr);
35 if (ret >= 0 && ret < 1024) { return null; }
36 PaymentId ret_hu_conv = new PaymentId(null, ret);
37 ret_hu_conv.ptrs_to.add(this);
42 * Checks if two PaymentIds contain equal inner contents.
43 * This ignores pointers and is_owned flags and looks at the values in fields.
44 * Two objects with NULL inner values will be considered "equal" here.
46 public boolean eq(PaymentId b) {
47 boolean ret = bindings.PaymentId_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
53 * Serialize the PaymentId object into a byte array which can be read by PaymentId_read
55 public byte[] write() {
56 byte[] ret = bindings.PaymentId_write(this.ptr);
61 * Read a PaymentId from a byte array, created by PaymentId_write
63 public static Result_PaymentIdDecodeErrorZ read(byte[] ser) {
64 long ret = bindings.PaymentId_read(ser);
65 if (ret >= 0 && ret < 1024) { return null; }
66 Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret);