Interface MethodMatcher
-
- All Superinterfaces:
java.util.function.Predicate<io.netty.handler.codec.http.HttpMethod>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface MethodMatcher extends java.util.function.Predicate<io.netty.handler.codec.http.HttpMethod>An interface defines matching methods for HTTP method.- Since:
- 1.1
-
-
Field Summary
Fields Modifier and Type Field Description static MethodMatcherANY_METHODMatches any method.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static MethodMatcherany()Returns the singleton matcherANY_METHOD.static MethodMatchereq(io.netty.handler.codec.http.HttpMethod method)Returns a matcher that checks if the specified method and coming method is equal.static MethodMatcherin(io.netty.handler.codec.http.HttpMethod... methods)Returns a matcher that checks if the coming method is equal to any one of the specified methods.default booleanmatches(HttpRequestContext ctx)Check if the method of the specifiedHttpRequestContextmatches this matcher or not.booleanmatches(io.netty.handler.codec.http.HttpMethod method)Check if the specifiedmethodmatches this matcher or not.default booleantest(io.netty.handler.codec.http.HttpMethod method)Evaluates this predicate on the specifiedmethod.
-
-
-
Field Detail
-
ANY_METHOD
static final MethodMatcher ANY_METHOD
Matches any method.Always returns
true.
-
-
Method Detail
-
any
static MethodMatcher any()
Returns the singleton matcherANY_METHOD.- Returns:
- the singleton matcher
ANY_METHOD
-
eq
static MethodMatcher eq(io.netty.handler.codec.http.HttpMethod method)
Returns a matcher that checks if the specified method and coming method is equal.- Parameters:
method- anHttpMethod- Returns:
- a matcher that checks if the specified method and coming method is equal
-
in
static MethodMatcher in(io.netty.handler.codec.http.HttpMethod... methods)
Returns a matcher that checks if the coming method is equal to any one of the specified methods.- Parameters:
methods- an array ofHttpMethod- Returns:
- a matcher that checks if the coming method is equal to any one of the specified methods
-
matches
boolean matches(io.netty.handler.codec.http.HttpMethod method)
Check if the specifiedmethodmatches this matcher or not.- Parameters:
method- anHttpMethod- Returns:
trueif the specifiedmethodmatches this matcher,falseotherwise
-
matches
default boolean matches(HttpRequestContext ctx)
Check if the method of the specifiedHttpRequestContextmatches this matcher or not.- Parameters:
ctx- the context of the HTTP request- Returns:
trueif the method of the specifiedHttpRequestContextmatches this matcher,falseotherwise
-
test
default boolean test(io.netty.handler.codec.http.HttpMethod method)
Evaluates this predicate on the specifiedmethod.This method is equivalent to
matches(HttpMethod).- Specified by:
testin interfacejava.util.function.Predicate<io.netty.handler.codec.http.HttpMethod>- Parameters:
method- anHttpMethod- Returns:
trueif the specifiedmethodmatches this matcher,falseotherwise
-
-