+ /**
+ * Utility method to constructs a new FeeRateTooHigh-variant APIError
+ */
+ public static APIError fee_rate_too_high(java.lang.String err, int feerate) {
+ long ret = bindings.APIError_fee_rate_too_high(err, feerate);
+ Reference.reachabilityFence(err);
+ Reference.reachabilityFence(feerate);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new InvalidRoute-variant APIError
+ */
+ public static APIError invalid_route(java.lang.String err) {
+ long ret = bindings.APIError_invalid_route(err);
+ Reference.reachabilityFence(err);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ChannelUnavailable-variant APIError
+ */
+ public static APIError channel_unavailable(java.lang.String err) {
+ long ret = bindings.APIError_channel_unavailable(err);
+ Reference.reachabilityFence(err);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new MonitorUpdateInProgress-variant APIError
+ */
+ public static APIError monitor_update_in_progress() {
+ long ret = bindings.APIError_monitor_update_in_progress();
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
+ */
+ public static APIError incompatible_shutdown_script(org.ldk.structs.ShutdownScript script) {
+ long ret = bindings.APIError_incompatible_shutdown_script(script == null ? 0 : script.ptr);
+ Reference.reachabilityFence(script);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(script); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Checks if two APIErrors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+ public boolean eq(org.ldk.structs.APIError b) {
+ boolean ret = bindings.APIError_eq(this.ptr, b == null ? 0 : b.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(b);
+ return ret;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (!(o instanceof APIError)) return false;
+ return this.eq((APIError)o);
+ }
+ /**
+ * Serialize the APIError object into a byte array which can be read by APIError_read
+ */
+ public byte[] write() {
+ byte[] ret = bindings.APIError_write(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+