Enum Class RequestPredicateKind
java.lang.Object
java.lang.Enum<RequestPredicateKind>
io.microsphere.spring.webflux.function.server.RequestPredicateKind
- All Implemented Interfaces:
Serializable,Comparable<RequestPredicateKind>,Constable
The kind of
RequestPredicate implementation- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
-
RequestPredicatesRequestPredicates.path(String)RequestPredicates.pathExtension(String)RequestPredicates.method(HttpMethod)RequestPredicates.queryParam(String, String)RequestPredicates.accept(MediaType...)RequestPredicates.contentType(MediaType...)RequestPredicate.and(RequestPredicate)RequestPredicate.or(RequestPredicate)RequestPredicate.negate()RequestPredicate.nest(ServerRequest)RequestPredicate
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionUnknown -
Method Summary
Modifier and TypeMethodDescriptionabstract Stringexpression(org.springframework.web.reactive.function.server.RequestPredicate predicate) Generates an expression string representation of the givenRequestPredicate.abstract booleanDetermines whether the givenexpressionmatches the currentRequestPredicateKindabstract booleanmatches(org.springframework.web.reactive.function.server.RequestPredicate predicate) Determines whether the givenRequestPredicatematches the currentRequestPredicateKindstatic org.springframework.web.reactive.function.server.RequestPredicateparseRequestPredicate(String expression) Parses the given expression into aRequestPredicate.abstract org.springframework.web.reactive.function.server.RequestPredicateBuilds aRequestPredicatefrom the givenexpressionstatic StringtoExpression(org.springframework.web.reactive.function.server.RequestPredicate predicate) Converts the givenRequestPredicateinto its string expression representation.static RequestPredicateKindReturns the enum constant of this class with the specified name.static RequestPredicateKindvalueOf(org.springframework.web.reactive.function.server.RequestPredicate predicate) Resolves theRequestPredicateKindfrom the givenRequestPredicatestatic RequestPredicateKind[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
AND
- See Also:
-
RequestPredicate.and(RequestPredicate)RequestPredicates.AndRequestPredicate
-
OR
- See Also:
-
RequestPredicate.or(RequestPredicate)RequestPredicates.OrRequestPredicate
-
NEGATE
- See Also:
-
RequestPredicate.negate()
-
METHOD
- See Also:
-
RequestPredicates.method(HttpMethod)RequestPredicates.HttpMethodPredicate
-
PATH
- See Also:
-
RequestPredicates.path(String)RequestPredicates.PathPatternPredicate
-
PATH_EXTENSION
- See Also:
-
RequestPredicates.pathExtension(String)
-
QUERY_PARAM
- See Also:
-
RequestPredicates.queryParam(String, String)RequestPredicates.QueryParamPredicate
-
ACCEPT
- See Also:
-
RequestPredicates.accept(MediaType...)
-
CONTENT_TYPE
- See Also:
-
RequestPredicates.contentType(MediaType...)
-
HEADERS
- See Also:
-
RequestPredicates.headers(Predicate)RequestPredicates.HeadersPredicate
-
UNKNOWN
Unknown
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
matches
public abstract boolean matches(org.springframework.web.reactive.function.server.RequestPredicate predicate) Determines whether the givenRequestPredicatematches the currentRequestPredicateKind- Parameters:
predicate- theRequestPredicate- Returns:
trueif matches, orfalse
-
matches
Determines whether the givenexpressionmatches the currentRequestPredicateKind- Parameters:
expression- the expression, like : "GET"- Returns:
trueif matches, orfalse
-
predicate
public abstract org.springframework.web.reactive.function.server.RequestPredicate predicate(@Nullable String expression) Builds aRequestPredicatefrom the givenexpression- Parameters:
expression- the expression, like : "GET"- Returns:
- the
RequestPredicateif matches, ornull
-
expression
public abstract String expression(org.springframework.web.reactive.function.server.RequestPredicate predicate) Generates an expression string representation of the givenRequestPredicate.This method provides a way to serialize a
RequestPredicateback into a string expression that can be used to recreate the same predicate usingparseRequestPredicate(String).Example Usage
- "GET" - represents a method predicate for GET requests
- "/users" - represents a path predicate for /users
- "*.json" - represents a path extension predicate for .json files
- "?name=value" - represents a query parameter predicate
- "Accept: application/json" - represents an accept header predicate
- "Content-Type: application/json" - represents a content type header predicate
- "(GET && /users)" - represents a compound AND predicate
- "(GET || POST)" - represents a compound OR predicate
- "!GET" - represents a negated predicate
- Parameters:
predicate- theRequestPredicateto convert to an expression- Returns:
- a string expression representing the
RequestPredicate - Throws:
NullPointerException- if therequestPredicateisnull- See Also:
-
parseRequestPredicate
public static org.springframework.web.reactive.function.server.RequestPredicate parseRequestPredicate(String expression) Parses the given expression into aRequestPredicate.The expression can be a simple predicate like "GET" or a complex one like "(GET && /users)".
Example Usage
- "GET" - matches GET requests
- "*.json" - matches requests with .json extension
- "?name=value" - matches requests with query parameter name=value
- "Accept: application/json" - matches requests accepting JSON
- "Content-Type: application/json" - matches requests with JSON content type
- "(GET && /users)" - matches GET requests to /users
- "(GET || POST)" - matches either GET or POST requests
- "!GET" - matches all requests except GET
- Parameters:
expression- the expression to parse- Returns:
- the parsed
RequestPredicate - Throws:
IllegalArgumentException- if the expression is invalid
-
toExpression
public static String toExpression(org.springframework.web.reactive.function.server.RequestPredicate predicate) Converts the givenRequestPredicateinto its string expression representation.This method is the inverse of
parseRequestPredicate(String). It takes aRequestPredicateand generates a string expression that represents the predicate. The generated expression can be used to recreate the same predicate usingparseRequestPredicate(String).Example Usage
- "GET" - represents a method predicate for GET requests
- "/users" - represents a path predicate for /users
- "*.json" - represents a path extension predicate for .json files
- "?name=value" - represents a query parameter predicate
- "Accept: application/json" - represents an accept header predicate
- "Content-Type: application/json" - represents a content type header predicate
- "(GET && /users)" - represents a compound AND predicate
- "(GET || POST)" - represents a compound OR predicate
- "!GET" - represents a negated predicate
- Parameters:
predicate- theRequestPredicateto convert to an expression- Returns:
- a string expression representing the
RequestPredicate - Throws:
NullPointerException- if thepredicateisnull- See Also:
-
valueOf
public static RequestPredicateKind valueOf(org.springframework.web.reactive.function.server.RequestPredicate predicate) Resolves theRequestPredicateKindfrom the givenRequestPredicate- Parameters:
predicate- the instance ofRequestPredicate- Returns:
- the
RequestPredicateKindenum constant, if not found, returnUNKNOWN - Throws:
NullPointerException- if thepredicateisnull- See Also:
-
RequestPredicate
-