io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter Maven / Gradle / Ivy
/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.vertx.rxjava3.ext.web.client.predicate;
import io.vertx.rxjava3.RxHelper;
import io.vertx.rxjava3.ObservableHelper;
import io.vertx.rxjava3.FlowableHelper;
import io.vertx.rxjava3.impl.AsyncResultMaybe;
import io.vertx.rxjava3.impl.AsyncResultSingle;
import io.vertx.rxjava3.impl.AsyncResultCompletable;
import io.vertx.rxjava3.WriteStreamObserver;
import io.vertx.rxjava3.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;
/**
* Converts a {@link io.vertx.rxjava3.ext.web.client.predicate.ResponsePredicateResult} to a Throwable
describing the error.
*
*
* NOTE: This class has been automatically generated from the {@link io.vertx.ext.web.client.predicate.ErrorConverter original} non RX-ified interface using Vert.x codegen.
*/
@RxGen(io.vertx.ext.web.client.predicate.ErrorConverter.class)
public class ErrorConverter {
@Override
public String toString() {
return delegate.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ErrorConverter that = (ErrorConverter) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new ErrorConverter((io.vertx.ext.web.client.predicate.ErrorConverter) obj),
ErrorConverter::getDelegate
);
private final io.vertx.ext.web.client.predicate.ErrorConverter delegate;
public ErrorConverter(io.vertx.ext.web.client.predicate.ErrorConverter delegate) {
this.delegate = delegate;
}
public ErrorConverter(Object delegate) {
this.delegate = (io.vertx.ext.web.client.predicate.ErrorConverter)delegate;
}
public io.vertx.ext.web.client.predicate.ErrorConverter getDelegate() {
return delegate;
}
/**
* Creates a full {@link io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter}, that will passed a predicate result with the response body.
*
* The converter
function will be invoked after the HTTP response body is received.
* @param converter a function creating a {@link java.lang.Throwable} from a {@link io.vertx.rxjava3.ext.web.client.predicate.ResponsePredicateResult}
* @return
*/
@Deprecated()
public static io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter create(java.util.function.Function converter) {
io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter ret = io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter.newInstance((io.vertx.ext.web.client.predicate.ErrorConverter)io.vertx.ext.web.client.predicate.ErrorConverter.create(new Function() {
public java.lang.Throwable apply(io.vertx.ext.web.client.predicate.ResponsePredicateResult arg) {
java.lang.Throwable ret = converter.apply(io.vertx.rxjava3.ext.web.client.predicate.ResponsePredicateResult.newInstance((io.vertx.ext.web.client.predicate.ResponsePredicateResult)arg));
return ret;
}
}));
return ret;
}
/**
* Creates a full {@link io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter}, that will passed a predicate result with the response body.
*
* The converter
function will be invoked after the HTTP response body is received.
* @param converter a function creating a {@link java.lang.Throwable} from a {@link io.vertx.rxjava3.ext.web.client.predicate.ResponsePredicateResult}
* @return
*/
@Deprecated()
public static io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter createFullBody(java.util.function.Function converter) {
io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter ret = io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter.newInstance((io.vertx.ext.web.client.predicate.ErrorConverter)io.vertx.ext.web.client.predicate.ErrorConverter.createFullBody(new Function() {
public java.lang.Throwable apply(io.vertx.ext.web.client.predicate.ResponsePredicateResult arg) {
java.lang.Throwable ret = converter.apply(io.vertx.rxjava3.ext.web.client.predicate.ResponsePredicateResult.newInstance((io.vertx.ext.web.client.predicate.ResponsePredicateResult)arg));
return ret;
}
}));
return ret;
}
@Deprecated()
public java.lang.Throwable apply(io.vertx.rxjava3.ext.web.client.predicate.ResponsePredicateResult result) {
java.lang.Throwable ret = delegate.apply(result.getDelegate());
return ret;
}
/**
* @return true
when the converter wants to process the request body.
*/
@Deprecated()
public boolean requiresBody() {
boolean ret = delegate.requiresBody();
return ret;
}
public static final io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter DEFAULT_CONVERTER = io.vertx.rxjava3.ext.web.client.predicate.ErrorConverter.newInstance((io.vertx.ext.web.client.predicate.ErrorConverter)io.vertx.ext.web.client.predicate.ErrorConverter.DEFAULT_CONVERTER);
public static ErrorConverter newInstance(io.vertx.ext.web.client.predicate.ErrorConverter arg) {
return arg != null ? new ErrorConverter(arg) : null;
}
}