Enum RequestPredicateKind

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<RequestPredicateKind>

    public enum RequestPredicateKind
    extends java.lang.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
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.String expression​(org.springframework.web.reactive.function.server.RequestPredicate predicate)
      Generates an expression string representation of the given RequestPredicate.
      abstract boolean matches​(java.lang.String expression)
      Determines whether the given expression matches the current RequestPredicateKind
      abstract boolean matches​(org.springframework.web.reactive.function.server.RequestPredicate predicate)
      Determines whether the given RequestPredicate matches the current RequestPredicateKind
      static org.springframework.web.reactive.function.server.RequestPredicate parseRequestPredicate​(java.lang.String expression)
      Parses the given expression into a RequestPredicate.
      abstract org.springframework.web.reactive.function.server.RequestPredicate predicate​(java.lang.String expression)
      Builds a RequestPredicate from the given expression
      static java.lang.String toExpression​(org.springframework.web.reactive.function.server.RequestPredicate predicate)
      Converts the given RequestPredicate into its string expression representation.
      static RequestPredicateKind valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static RequestPredicateKind valueOf​(org.springframework.web.reactive.function.server.RequestPredicate predicate)
      Resolves the RequestPredicateKind from the given RequestPredicate
      static RequestPredicateKind[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • 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
      • 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
    • 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 name
        java.lang.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
                                        java.lang.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
                                                                                                    java.lang.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 java.lang.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:
        java.lang.NullPointerException - if the requestPredicate is null
        See Also:
        parseRequestPredicate(String)
      • parseRequestPredicate

        public static org.springframework.web.reactive.function.server.RequestPredicate parseRequestPredicate​(java.lang.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:
        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 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:
        java.lang.NullPointerException - if the predicate is null
        See Also:
        parseRequestPredicate(String), expression(RequestPredicate)
      • 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:
        java.lang.NullPointerException - if the predicate is null
        See Also:
        RequestPredicate