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 * Private routing information
14 * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class PrivateRoute extends CommonBase {
18 PrivateRoute(Object _dummy, long ptr) { super(ptr); }
19 @Override @SuppressWarnings("deprecation")
20 protected void finalize() throws Throwable {
22 if (ptr != 0) { bindings.PrivateRoute_free(ptr); }
26 * Checks if two PrivateRoutes contain equal inner contents.
27 * This ignores pointers and is_owned flags and looks at the values in fields.
28 * Two objects with NULL inner values will be considered "equal" here.
30 public boolean eq(PrivateRoute b) {
31 boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
37 * Creates a copy of the PrivateRoute
39 public PrivateRoute clone() {
40 long ret = bindings.PrivateRoute_clone(this.ptr);
41 if (ret < 1024) { return null; }
42 PrivateRoute ret_hu_conv = new PrivateRoute(null, ret);
43 ret_hu_conv.ptrs_to.add(this);
48 * Creates a new (partial) route from a list of hops
50 public static Result_PrivateRouteCreationErrorZ of(RouteHint hops) {
51 long ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1);
52 if (ret < 1024) { return null; }
53 Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret);
54 ret_hu_conv.ptrs_to.add(hops);
59 * Returns the underlying list of hops
61 public RouteHint into_inner() {
62 long ret = bindings.PrivateRoute_into_inner(this.ptr);
63 if (ret < 1024) { return null; }
64 RouteHint ret_hu_conv = new RouteHint(null, ret);
65 ret_hu_conv.ptrs_to.add(this);
66 this.ptrs_to.add(this);