Enum Class RequestPredicateKind

java.lang.Object
java.lang.Enum<RequestPredicateKind>
io.microsphere.spring.webflux.function.server.RequestPredicateKind
All Implemented Interfaces:
Serializable, Comparable<RequestPredicateKind>, Constable

public enum RequestPredicateKind extends Enum<RequestPredicateKind>
The kind of RequestPredicate implementation
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 Details

    • 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 Details

    • values

      public static RequestPredicateKind[] 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

      public static RequestPredicateKind valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • matches

      public abstract boolean matches(org.springframework.web.reactive.function.server.RequestPredicate predicate)
      Determines whether the given RequestPredicate matches the current RequestPredicateKind
      Parameters:
      predicate - the RequestPredicate
      Returns:
      true if matches, or false
    • matches

      public abstract boolean matches(@Nullable String expression)
      Determines whether the given expression matches the current RequestPredicateKind
      Parameters:
      expression - the expression, like : "GET"
      Returns:
      true if matches, or false
    • predicate

      public abstract org.springframework.web.reactive.function.server.RequestPredicate predicate(@Nullable String expression)
      Builds a RequestPredicate from the given expression
      Parameters:
      expression - the expression, like : "GET"
      Returns:
      the RequestPredicate if matches, or null
    • expression

      public abstract String expression(org.springframework.web.reactive.function.server.RequestPredicate predicate)
      Generates an expression string representation of the given RequestPredicate.

      This method provides a way to serialize a RequestPredicate back into a string expression that can be used to recreate the same predicate using parseRequestPredicate(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 - the RequestPredicate to convert to an expression
      Returns:
      a string expression representing the RequestPredicate
      Throws:
      NullPointerException - if the requestPredicate is null
      See Also:
    • parseRequestPredicate

      public static org.springframework.web.reactive.function.server.RequestPredicate parseRequestPredicate(String expression)
      Parses the given expression into a RequestPredicate.

      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 given RequestPredicate into its string expression representation.

      This method is the inverse of parseRequestPredicate(String). It takes a RequestPredicate and generates a string expression that represents the predicate. The generated expression can be used to recreate the same predicate using parseRequestPredicate(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 - the RequestPredicate to convert to an expression
      Returns:
      a string expression representing the RequestPredicate
      Throws:
      NullPointerException - if the predicate is null
      See Also:
    • valueOf

      public static RequestPredicateKind valueOf(org.springframework.web.reactive.function.server.RequestPredicate predicate)
      Resolves the RequestPredicateKind from the given RequestPredicate
      Parameters:
      predicate - the instance of RequestPredicate
      Returns:
      the RequestPredicateKind enum constant, if not found, return UNKNOWN
      Throws:
      NullPointerException - if the predicate is null
      See Also:
      • RequestPredicate