org.zalando.riptide.Binding 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
The newest version!
package org.zalando.riptide;
import org.apiguardian.api.API;
import javax.annotation.Nullable;
import static org.apiguardian.api.API.Status.INTERNAL;
import static org.apiguardian.api.API.Status.STABLE;
/**
* Bindings are the building blocks of {@link RoutingTree routing trees}. They bind an {@link #getAttribute() attribute}
* to a {@link #getRoute() route}. A binding represents a choice to the {@link Navigator navigator} which route to
* follow.
*
* @param generic attribute type
*/
@API(status = STABLE)
public final class Binding {
private final A attribute;
private final Route route;
private Binding(@Nullable final A attribute, final Route route) {
this.attribute = attribute;
this.route = route;
}
@Nullable
public A getAttribute() {
return attribute;
}
public Route getRoute() {
return route;
}
/**
* A static factory to create bindings. {@link Bindings#on(Object)} and {@link PartialBinding} provide the same
* functionality but with some more syntactic sugar.
*
* @param attribute attribute to bind
* @param route route to bind to
* @param generic attribute type
* @return a binding of attribute to route
* @see PartialBinding
*/
@API(status = INTERNAL)
public static Binding create(@Nullable final A attribute, final Route route) {
return new Binding<>(attribute, route);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy