All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zalando.riptide.PartialBinding Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
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 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);
    }

}