org.jboss.resteasy.reactive.client.impl.UniInvoker Maven / Gradle / Ivy
package org.jboss.resteasy.reactive.client.impl;
import java.util.concurrent.CompletionStage;
import java.util.function.Function;
import java.util.function.Supplier;
import jakarta.ws.rs.ProcessingException;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import io.smallrye.mutiny.Uni;
public class UniInvoker extends AbstractRxInvoker> {
private InvocationBuilderImpl invocationBuilder;
public UniInvoker(InvocationBuilderImpl invocationBuilder) {
this.invocationBuilder = invocationBuilder;
}
@Override
public Uni method(String name, Entity> entity, GenericType responseType) {
AsyncInvokerImpl invoker = (AsyncInvokerImpl) invocationBuilder.rx();
return Uni.createFrom().completionStage(new Supplier>() {
@Override
public CompletionStage get() {
return invoker.method(name, entity, responseType);
}
}).onFailure().transform(new Function<>() {
@Override
public Throwable apply(Throwable t) {
if ((t instanceof ProcessingException) && (t.getCause() != null)) {
return t.getCause();
}
return t;
}
});
}
@Override
public Uni get() {
return (Uni) super.get();
}
@Override
public Uni get(Class responseType) {
return (Uni) super.get(responseType);
}
@Override
public Uni get(GenericType responseType) {
return (Uni) super.get(responseType);
}
@Override
public Uni put(Entity> entity) {
return (Uni) super.put(entity);
}
@Override
public Uni put(Entity> entity, Class clazz) {
return (Uni) super.put(entity, clazz);
}
@Override
public Uni put(Entity> entity, GenericType type) {
return (Uni) super.put(entity, type);
}
@Override
public Uni post(Entity> entity) {
return (Uni) super.post(entity);
}
@Override
public Uni post(Entity> entity, Class clazz) {
return (Uni) super.post(entity, clazz);
}
@Override
public Uni post(Entity> entity, GenericType type) {
return (Uni) super.post(entity, type);
}
@Override
public Uni delete() {
return (Uni) super.delete();
}
@Override
public Uni delete(Class responseType) {
return (Uni) super.delete(responseType);
}
@Override
public Uni delete(GenericType responseType) {
return (Uni) super.delete(responseType);
}
@Override
public Uni head() {
return (Uni) super.head();
}
@Override
public Uni options() {
return (Uni) super.options();
}
@Override
public Uni options(Class responseType) {
return (Uni) super.options(responseType);
}
@Override
public Uni options(GenericType responseType) {
return (Uni) super.options(responseType);
}
@Override
public Uni trace() {
return (Uni) super.trace();
}
@Override
public Uni trace(Class responseType) {
return (Uni) super.trace(responseType);
}
@Override
public Uni trace(GenericType responseType) {
return (Uni) super.trace(responseType);
}
@Override
public Uni method(String name) {
return (Uni) super.method(name);
}
@Override
public Uni method(String name, Class responseType) {
return (Uni) super.method(name, responseType);
}
@Override
public Uni method(String name, GenericType responseType) {
return (Uni) super.method(name, responseType);
}
@Override
public Uni method(String name, Entity> entity) {
return (Uni) super.method(name, entity);
}
@Override
public Uni method(String name, Entity> entity, Class responseType) {
return (Uni) super.method(name, entity, responseType);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy