com.coveo.feign.ThrownExceptionDetails Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of feign-error-decoder Show documentation
Show all versions of feign-error-decoder Show documentation
A Feign reflection error decoder that eases the pain in rethrowing checked and unchecked exceptions.
package com.coveo.feign;
import java.lang.reflect.InvocationTargetException;
public class ThrownExceptionDetails {
private Class clazz;
private ExceptionSupplier exceptionSupplier;
public Class getClazz() {
return clazz;
}
public void setClazz(Class clazz) {
this.clazz = clazz;
}
public ExceptionSupplier getServiceExceptionSupplier() {
return exceptionSupplier;
}
public void setServiceExceptionSupplier(ExceptionSupplier serviceExceptionSupplier) {
this.exceptionSupplier = serviceExceptionSupplier;
}
public ThrownExceptionDetails withClazz(Class clazz) {
setClazz(clazz);
return this;
}
public ThrownExceptionDetails withServiceExceptionSupplier(ExceptionSupplier supplier) {
setServiceExceptionSupplier(supplier);
return this;
}
public T instantiate()
throws InstantiationException, IllegalAccessException, IllegalArgumentException,
InvocationTargetException {
return exceptionSupplier.get();
}
}