org.zalando.riptide.RoutingTree 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 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);
}
}