]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/Bolt12RefundContext.java
[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / Bolt12RefundContext.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  * The context of a payment made for an invoice sent for a BOLT 12 [`Refund`].
13  * 
14  * [`Refund`]: crate::offers::refund::Refund
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class Bolt12RefundContext extends CommonBase {
18         Bolt12RefundContext(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.Bolt12RefundContext_free(ptr); }
23         }
24
25         /**
26          * Constructs a new Bolt12RefundContext given each field
27          */
28         public static Bolt12RefundContext of() {
29                 long ret = bindings.Bolt12RefundContext_new();
30                 if (ret >= 0 && ret <= 4096) { return null; }
31                 org.ldk.structs.Bolt12RefundContext ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12RefundContext(null, ret); }
32                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
33                 return ret_hu_conv;
34         }
35
36         long clone_ptr() {
37                 long ret = bindings.Bolt12RefundContext_clone_ptr(this.ptr);
38                 Reference.reachabilityFence(this);
39                 return ret;
40         }
41
42         /**
43          * Creates a copy of the Bolt12RefundContext
44          */
45         public Bolt12RefundContext clone() {
46                 long ret = bindings.Bolt12RefundContext_clone(this.ptr);
47                 Reference.reachabilityFence(this);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 org.ldk.structs.Bolt12RefundContext ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Bolt12RefundContext(null, ret); }
50                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
51                 return ret_hu_conv;
52         }
53
54         /**
55          * Checks if two Bolt12RefundContexts contain equal inner contents.
56          * This ignores pointers and is_owned flags and looks at the values in fields.
57          * Two objects with NULL inner values will be considered "equal" here.
58          */
59         public boolean eq(org.ldk.structs.Bolt12RefundContext b) {
60                 boolean ret = bindings.Bolt12RefundContext_eq(this.ptr, b.ptr);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(b);
63                 if (this != null) { this.ptrs_to.add(b); };
64                 return ret;
65         }
66
67         @Override public boolean equals(Object o) {
68                 if (!(o instanceof Bolt12RefundContext)) return false;
69                 return this.eq((Bolt12RefundContext)o);
70         }
71         /**
72          * Serialize the Bolt12RefundContext object into a byte array which can be read by Bolt12RefundContext_read
73          */
74         public byte[] write() {
75                 byte[] ret = bindings.Bolt12RefundContext_write(this.ptr);
76                 Reference.reachabilityFence(this);
77                 return ret;
78         }
79
80         /**
81          * Read a Bolt12RefundContext from a byte array, created by Bolt12RefundContext_write
82          */
83         public static Result_Bolt12RefundContextDecodeErrorZ read(byte[] ser) {
84                 long ret = bindings.Bolt12RefundContext_read(ser);
85                 Reference.reachabilityFence(ser);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 Result_Bolt12RefundContextDecodeErrorZ ret_hu_conv = Result_Bolt12RefundContextDecodeErrorZ.constr_from_ptr(ret);
88                 return ret_hu_conv;
89         }
90
91 }