X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FPaymentSendFailure.java;h=b329a41387c74fd6246b763791726c2e5b780230;hb=17113550a5fefab21f39f27fbfe02646b8db53ae;hp=5db694eed14b84de99545c97f5b97c298f53ada4;hpb=110f2f104ba8fc34caa7e34e04737f36f064b050;p=ldk-java diff --git a/src/main/java/org/ldk/structs/PaymentSendFailure.java b/src/main/java/org/ldk/structs/PaymentSendFailure.java index 5db694ee..b329a413 100644 --- a/src/main/java/org/ldk/structs/PaymentSendFailure.java +++ b/src/main/java/org/ldk/structs/PaymentSendFailure.java @@ -5,13 +5,55 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * If a payment fails to send, it can be in one of several states. This enum is returned as the + * Err() type describing which state the payment is in, see the description of individual enum + * states for more. + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class PaymentSendFailure extends CommonBase { - PaymentSendFailure(Object _dummy, long ptr) { super(ptr); } + private PaymentSendFailure(Object _dummy, long ptr) { super(ptr); } @Override @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); - bindings.PaymentSendFailure_free(ptr); + if (ptr != 0) { bindings.PaymentSendFailure_free(ptr); } + } + static PaymentSendFailure constr_from_ptr(long ptr) { + bindings.LDKPaymentSendFailure raw_val = bindings.LDKPaymentSendFailure_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKPaymentSendFailure.ParameterError.class) { + return new ParameterError(ptr, (bindings.LDKPaymentSendFailure.ParameterError)raw_val); + } + if (raw_val.getClass() == bindings.LDKPaymentSendFailure.PathParameterError.class) { + return new PathParameterError(ptr, (bindings.LDKPaymentSendFailure.PathParameterError)raw_val); + } + if (raw_val.getClass() == bindings.LDKPaymentSendFailure.AllFailedRetrySafe.class) { + return new AllFailedRetrySafe(ptr, (bindings.LDKPaymentSendFailure.AllFailedRetrySafe)raw_val); + } + if (raw_val.getClass() == bindings.LDKPaymentSendFailure.PartialFailure.class) { + return new PartialFailure(ptr, (bindings.LDKPaymentSendFailure.PartialFailure)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface } + public final static class ParameterError extends PaymentSendFailure { + private ParameterError(long ptr, bindings.LDKPaymentSendFailure.ParameterError obj) { + super(null, ptr); + } + } + public final static class PathParameterError extends PaymentSendFailure { + private PathParameterError(long ptr, bindings.LDKPaymentSendFailure.PathParameterError obj) { + super(null, ptr); + } + } + public final static class AllFailedRetrySafe extends PaymentSendFailure { + private AllFailedRetrySafe(long ptr, bindings.LDKPaymentSendFailure.AllFailedRetrySafe obj) { + super(null, ptr); + } + } + public final static class PartialFailure extends PaymentSendFailure { + private PartialFailure(long ptr, bindings.LDKPaymentSendFailure.PartialFailure obj) { + super(null, ptr); + } + } }