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

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

There is a newer version: 4.0.0
Show newest version
package org.zalando.riptide;

import org.springframework.http.client.ClientHttpResponse;

import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;

import static java.util.Arrays.asList;

public interface RoutingTree extends Route {

    Navigator getNavigator();

    Set keySet();

    Optional get(final A attribute);

    Optional getWildcard();

    /**
     * @throws NoWildcardException if no route, not even a wildcard, exists for the given response
     */
    @Override
    void execute(final ClientHttpResponse response, final MessageReader reader) throws Exception;

    default RoutingTree merge(final Binding binding) {
        return merge(Collections.singletonList(binding));
    }

    RoutingTree merge(final List> bindings);

    @SafeVarargs
    static  RoutingTree dispatch(final Navigator navigator, final Binding... bindings) {
        return dispatch(navigator, asList(bindings));
    }

    static  RoutingTree dispatch(final Navigator navigator, final List> bindings) {
        return new DefaultRoutingTree<>(navigator, bindings);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy