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