[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / PaymentConstraints.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  * Constraints for relaying over a given [`BlindedHop`].
13  * 
14  * [`BlindedHop`]: crate::blinded_path::BlindedHop
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class PaymentConstraints extends CommonBase {
18         PaymentConstraints(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.PaymentConstraints_free(ptr); }
23         }
24
25         /**
26          * The maximum total CLTV delta that is acceptable when relaying a payment over this
27          * [`BlindedHop`].
28          */
29         public int get_max_cltv_expiry() {
30                 int ret = bindings.PaymentConstraints_get_max_cltv_expiry(this.ptr);
31                 Reference.reachabilityFence(this);
32                 return ret;
33         }
34
35         /**
36          * The maximum total CLTV delta that is acceptable when relaying a payment over this
37          * [`BlindedHop`].
38          */
39         public void set_max_cltv_expiry(int val) {
40                 bindings.PaymentConstraints_set_max_cltv_expiry(this.ptr, val);
41                 Reference.reachabilityFence(this);
42                 Reference.reachabilityFence(val);
43         }
44
45         /**
46          * The minimum value, in msat, that may be accepted by the node corresponding to this
47          * [`BlindedHop`].
48          */
49         public long get_htlc_minimum_msat() {
50                 long ret = bindings.PaymentConstraints_get_htlc_minimum_msat(this.ptr);
51                 Reference.reachabilityFence(this);
52                 return ret;
53         }
54
55         /**
56          * The minimum value, in msat, that may be accepted by the node corresponding to this
57          * [`BlindedHop`].
58          */
59         public void set_htlc_minimum_msat(long val) {
60                 bindings.PaymentConstraints_set_htlc_minimum_msat(this.ptr, val);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(val);
63         }
64
65         /**
66          * Constructs a new PaymentConstraints given each field
67          */
68         public static PaymentConstraints of(int max_cltv_expiry_arg, long htlc_minimum_msat_arg) {
69                 long ret = bindings.PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
70                 Reference.reachabilityFence(max_cltv_expiry_arg);
71                 Reference.reachabilityFence(htlc_minimum_msat_arg);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.PaymentConstraints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentConstraints(null, ret); }
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
75                 return ret_hu_conv;
76         }
77
78         long clone_ptr() {
79                 long ret = bindings.PaymentConstraints_clone_ptr(this.ptr);
80                 Reference.reachabilityFence(this);
81                 return ret;
82         }
83
84         /**
85          * Creates a copy of the PaymentConstraints
86          */
87         public PaymentConstraints clone() {
88                 long ret = bindings.PaymentConstraints_clone(this.ptr);
89                 Reference.reachabilityFence(this);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 org.ldk.structs.PaymentConstraints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentConstraints(null, ret); }
92                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
93                 return ret_hu_conv;
94         }
95
96         /**
97          * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read
98          */
99         public byte[] write() {
100                 byte[] ret = bindings.PaymentConstraints_write(this.ptr);
101                 Reference.reachabilityFence(this);
102                 return ret;
103         }
104
105         /**
106          * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write
107          */
108         public static Result_PaymentConstraintsDecodeErrorZ read(byte[] ser) {
109                 long ret = bindings.PaymentConstraints_read(ser);
110                 Reference.reachabilityFence(ser);
111                 if (ret >= 0 && ret <= 4096) { return null; }
112                 Result_PaymentConstraintsDecodeErrorZ ret_hu_conv = Result_PaymentConstraintsDecodeErrorZ.constr_from_ptr(ret);
113                 return ret_hu_conv;
114         }
115
116 }