org.zalando.riptide.Bindings 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 com.google.common.reflect.TypeToken;
import org.apiguardian.api.API;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import static org.apiguardian.api.API.Status.STABLE;
/**
* Static factories that form entry points to create full {@link Binding bindings}.
*
* @see Binding
*/
@API(status = STABLE)
public final class Bindings {
private Bindings() {
}
public static PartialBinding on(final A attribute) {
return new PartialBinding<>(attribute);
}
/**
* Creates a wildcard condition for the given type. Note that this method is meant to be
* used as a base for specialized factory methods, e.g. like {@link #anyStatus()}.
*
* @param type attribute type
* @param generic attribute type
* @return an any condition on the given attribute type
* @see #any(TypeToken)
* @see #anySeries()
* @see #anyStatus()
* @see #anyStatusCode()
* @see #anyContentType()
*/
public static PartialBinding any(final Class type) {
return any(TypeToken.of(type));
}
/**
* Creates a wildcard condition for the given type. Note that this method is meant to be
* used as a base for specialized factory methods, e.g. like {@link #anyStatus()}.
*
* @param type attribute type
* @param generic attribute type
* @return an any condition on the given attribute type
* @see #any(Class)
* @see #anySeries()
* @see #anyStatus()
* @see #anyStatusCode()
* @see #anyContentType()
*/
public static PartialBinding any(@SuppressWarnings("UnusedParameters") final TypeToken type) {
return new PartialBinding<>(null);
}
public static PartialBinding anySeries() {
return any(HttpStatus.Series.class);
}
public static PartialBinding anyStatus() {
return any(HttpStatus.class);
}
public static PartialBinding anyStatusCode() {
return any(Integer.class);
}
public static PartialBinding anyContentType() {
return any(MediaType.class);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy