/*
* 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.reactivex.ext.web.client.predicate;
import io.vertx.reactivex.RxHelper;
import io.vertx.reactivex.ObservableHelper;
import io.vertx.reactivex.FlowableHelper;
import io.vertx.reactivex.impl.AsyncResultMaybe;
import io.vertx.reactivex.impl.AsyncResultSingle;
import io.vertx.reactivex.impl.AsyncResultCompletable;
import io.vertx.reactivex.WriteStreamObserver;
import io.vertx.reactivex.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 ResponsePredicateResult
to a Throwable
describing the error.
NOTE: This class has been automatically generated from the original
non RX-ified interface using Vert.x codegen. /**
* Converts a {@link io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult} to a <code>Throwable</code> describing the error.
*
* <p/>
* 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<ErrorConverter> __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 ErrorConverter
, that will passed a predicate result with the response body. The converter
function will be invoked after the HTTP response body is received.
Params: - converter – a function creating a
Throwable
from a ResponsePredicateResult
Returns:
/**
* Creates a full {@link io.vertx.reactivex.ext.web.client.predicate.ErrorConverter}, that will passed a predicate result with the response body.
*
* <p>The <code>converter</code> function will be invoked <em>after</em> the HTTP response body is received.
* @param converter a function creating a {@link java.lang.Throwable} from a {@link io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult}
* @return
*/
public static io.vertx.reactivex.ext.web.client.predicate.ErrorConverter create(Function<io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult, java.lang.Throwable> converter) {
io.vertx.reactivex.ext.web.client.predicate.ErrorConverter ret = io.vertx.reactivex.ext.web.client.predicate.ErrorConverter.newInstance((io.vertx.ext.web.client.predicate.ErrorConverter)io.vertx.ext.web.client.predicate.ErrorConverter.create(new Function<io.vertx.ext.web.client.predicate.ResponsePredicateResult,java.lang.Throwable>() {
public java.lang.Throwable apply(io.vertx.ext.web.client.predicate.ResponsePredicateResult arg) {
java.lang.Throwable ret = converter.apply(io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult.newInstance((io.vertx.ext.web.client.predicate.ResponsePredicateResult)arg));
return ret;
}
}));
return ret;
}
Creates a full ErrorConverter
, that will passed a predicate result with the response body. The converter
function will be invoked after the HTTP response body is received.
Params: - converter – a function creating a
Throwable
from a ResponsePredicateResult
Returns:
/**
* Creates a full {@link io.vertx.reactivex.ext.web.client.predicate.ErrorConverter}, that will passed a predicate result with the response body.
*
* <p>The <code>converter</code> function will be invoked <em>after</em> the HTTP response body is received.
* @param converter a function creating a {@link java.lang.Throwable} from a {@link io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult}
* @return
*/
public static io.vertx.reactivex.ext.web.client.predicate.ErrorConverter createFullBody(Function<io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult, java.lang.Throwable> converter) {
io.vertx.reactivex.ext.web.client.predicate.ErrorConverter ret = io.vertx.reactivex.ext.web.client.predicate.ErrorConverter.newInstance((io.vertx.ext.web.client.predicate.ErrorConverter)io.vertx.ext.web.client.predicate.ErrorConverter.createFullBody(new Function<io.vertx.ext.web.client.predicate.ResponsePredicateResult,java.lang.Throwable>() {
public java.lang.Throwable apply(io.vertx.ext.web.client.predicate.ResponsePredicateResult arg) {
java.lang.Throwable ret = converter.apply(io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult.newInstance((io.vertx.ext.web.client.predicate.ResponsePredicateResult)arg));
return ret;
}
}));
return ret;
}
public java.lang.Throwable apply(io.vertx.reactivex.ext.web.client.predicate.ResponsePredicateResult result) {
java.lang.Throwable ret = delegate.apply(result.getDelegate());
return ret;
}
Returns: true
when the converter wants to process the request body.
/**
* @return <code>true</code> when the converter wants to process the request body.
*/
public boolean requiresBody() {
boolean ret = delegate.requiresBody();
return ret;
}
public static final io.vertx.reactivex.ext.web.client.predicate.ErrorConverter DEFAULT_CONVERTER = io.vertx.reactivex.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;
}
}