Enum RequestPredicateKind
- java.lang.Object
-
- java.lang.Enum<RequestPredicateKind>
-
- io.microsphere.spring.webflux.function.server.RequestPredicateKind
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<RequestPredicateKind>
public enum RequestPredicateKind extends java.lang.Enum<RequestPredicateKind>
The kind ofRequestPredicateimplementation- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
RequestPredicates,RequestPredicates.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
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ACCEPTANDCONTENT_TYPEHEADERSMETHODNEGATEORPATHPATH_EXTENSIONQUERY_PARAMUNKNOWNUnknown
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Stringexpression(org.springframework.web.reactive.function.server.RequestPredicate predicate)Generates an expression string representation of the givenRequestPredicate.abstract booleanmatches(java.lang.String expression)Determines 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(java.lang.String expression)Parses the given expression into aRequestPredicate.abstract org.springframework.web.reactive.function.server.RequestPredicatepredicate(java.lang.String expression)Builds aRequestPredicatefrom the givenexpressionstatic java.lang.StringtoExpression(org.springframework.web.reactive.function.server.RequestPredicate predicate)Converts the givenRequestPredicateinto its string expression representation.static RequestPredicateKindvalueOf(java.lang.String name)Returns the enum constant of this type 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 type, in the order they are declared.
-
-
-
Enum Constant Detail
-
AND
public static final RequestPredicateKind AND
- See Also:
RequestPredicate.and(RequestPredicate),RequestPredicates.AndRequestPredicate
-
OR
public static final RequestPredicateKind OR
- See Also:
RequestPredicate.or(RequestPredicate),RequestPredicates.OrRequestPredicate
-
NEGATE
public static final RequestPredicateKind NEGATE
- See Also:
RequestPredicate.negate()
-
METHOD
public static final RequestPredicateKind METHOD
- See Also:
RequestPredicates.method(HttpMethod),RequestPredicates.HttpMethodPredicate
-
PATH
public static final RequestPredicateKind PATH
- See Also:
RequestPredicates.path(String),RequestPredicates.PathPatternPredicate
-
PATH_EXTENSION
public static final RequestPredicateKind PATH_EXTENSION
- See Also:
RequestPredicates.pathExtension(String)
-
QUERY_PARAM
public static final RequestPredicateKind QUERY_PARAM
- See Also:
RequestPredicates.queryParam(String, String),RequestPredicates.QueryParamPredicate
-
ACCEPT
public static final RequestPredicateKind ACCEPT
- See Also:
RequestPredicates.accept(MediaType...)
-
CONTENT_TYPE
public static final RequestPredicateKind CONTENT_TYPE
- See Also:
RequestPredicates.contentType(MediaType...)
-
HEADERS
public static final RequestPredicateKind HEADERS
- See Also:
RequestPredicates.headers(Predicate),RequestPredicates.HeadersPredicate
-
UNKNOWN
public static final RequestPredicateKind UNKNOWN
Unknown
-
-
Method Detail
-
values
public static RequestPredicateKind[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RequestPredicateKind c : RequestPredicateKind.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RequestPredicateKind valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- 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
public abstract boolean matches(@Nullable java.lang.String expression)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 java.lang.String expression)Builds aRequestPredicatefrom the givenexpression- Parameters:
expression- the expression, like : "GET"- Returns:
- the
RequestPredicateif matches, ornull
-
expression
public abstract java.lang.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:
java.lang.NullPointerException- if therequestPredicateisnull- See Also:
parseRequestPredicate(String)
-
parseRequestPredicate
public static org.springframework.web.reactive.function.server.RequestPredicate parseRequestPredicate(java.lang.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:
java.lang.IllegalArgumentException- if the expression is invalid
-
toExpression
public static java.lang.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:
java.lang.NullPointerException- if thepredicateisnull- See Also:
parseRequestPredicate(String),expression(RequestPredicate)
-
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:
java.lang.NullPointerException- if thepredicateisnull- See Also:
RequestPredicate
-
-