org.zalando.riptide.PartialBinding Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riptide-core Show documentation
Show all versions of riptide-core Show documentation
Client side response routing
package org.zalando.riptide;
import com.google.common.reflect.TypeToken;
import org.springframework.http.client.ClientHttpResponse;
import org.zalando.fauxpas.ThrowingConsumer;
import org.zalando.fauxpas.ThrowingRunnable;
import javax.annotation.Nullable;
public final class PartialBinding {
private final A attribute;
PartialBinding(@Nullable final A attribute) {
this.attribute = attribute;
}
public Binding call(final ThrowingRunnable extends Exception> consumer) {
return call(Route.call(consumer));
}
public Binding call(final ThrowingConsumer consumer) {
return call(Route.call(consumer));
}
public Binding call(final Class type, final ThrowingConsumer consumer) {
return call(Route.call(type, consumer));
}
public Binding call(final TypeToken type, final ThrowingConsumer consumer) {
return call(Route.call(type, consumer));
}
@SafeVarargs
public final Binding dispatch(final Navigator navigator, final Binding... bindings) {
return call(RoutingTree.dispatch(navigator, bindings));
}
public Binding call(final Route route) {
return Binding.create(attribute, route);
}
}