1f9d3f0a8d6c63084c8bc5e2efaa8a83f81ff3f7
[ldk-java] / src / main / java / org / ldk / structs / RawDataPart.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  * Data of the `RawInvoice` that is encoded in the data part
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class RawDataPart extends CommonBase {
16         RawDataPart(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.RawDataPart_free(ptr); }
21         }
22
23         /**
24          * generation time of the invoice
25          */
26         public PositiveTimestamp get_timestamp() {
27                 long ret = bindings.RawDataPart_get_timestamp(this.ptr);
28                 Reference.reachabilityFence(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 org.ldk.structs.PositiveTimestamp ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PositiveTimestamp(null, ret); }
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * generation time of the invoice
37          */
38         public void set_timestamp(PositiveTimestamp val) {
39                 bindings.RawDataPart_set_timestamp(this.ptr, val == null ? 0 : val.ptr);
40                 Reference.reachabilityFence(this);
41                 Reference.reachabilityFence(val);
42                 if (this != null) { this.ptrs_to.add(val); };
43         }
44
45         /**
46          * Checks if two RawDataParts contain equal inner contents.
47          * This ignores pointers and is_owned flags and looks at the values in fields.
48          * Two objects with NULL inner values will be considered "equal" here.
49          */
50         public boolean eq(RawDataPart b) {
51                 boolean ret = bindings.RawDataPart_eq(this.ptr, b == null ? 0 : b.ptr);
52                 Reference.reachabilityFence(this);
53                 Reference.reachabilityFence(b);
54                 if (this != null) { this.ptrs_to.add(b); };
55                 return ret;
56         }
57
58         @Override public boolean equals(Object o) {
59                 if (!(o instanceof RawDataPart)) return false;
60                 return this.eq((RawDataPart)o);
61         }
62         long clone_ptr() {
63                 long ret = bindings.RawDataPart_clone_ptr(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * Creates a copy of the RawDataPart
70          */
71         public RawDataPart clone() {
72                 long ret = bindings.RawDataPart_clone(this.ptr);
73                 Reference.reachabilityFence(this);
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 org.ldk.structs.RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawDataPart(null, ret); }
76                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
77                 return ret_hu_conv;
78         }
79
80 }