Spring Framework

org.springframework.web.servlet.mvc.condition
Class ParamsRequestCondition

java.lang.Object
  extended by org.springframework.web.servlet.mvc.condition.AbstractRequestCondition<ParamsRequestCondition>
      extended by org.springframework.web.servlet.mvc.condition.ParamsRequestCondition
All Implemented Interfaces:
RequestCondition<ParamsRequestCondition>

public final class ParamsRequestCondition
extends AbstractRequestCondition<ParamsRequestCondition>

A logical conjunction (' && ') request condition that matches a request against a set parameter expressions with syntax defined in RequestMapping.params().

Since:
3.1
Author:
Arjen Poutsma, Rossen Stoyanchev

Constructor Summary
ParamsRequestCondition(java.lang.String... params)
          Create a new instance from the given param expressions.
 
Method Summary
 ParamsRequestCondition combine(ParamsRequestCondition other)
          Returns a new instance with the union of the param expressions from "this" and the "other" instance.
 int compareTo(ParamsRequestCondition other, javax.servlet.http.HttpServletRequest request)
          Returns: 0 if the two conditions have the same number of parameter expressions Less than 0 if "this" instance has more parameter expressions Greater than 0 if the "other" instance has more parameter expressions
protected  java.util.Collection<org.springframework.web.servlet.mvc.condition.ParamsRequestCondition.ParamExpression> getContent()
          Return the discrete items a request condition is composed of.
 java.util.Set<NameValueExpression<java.lang.String>> getExpressions()
          Return the contained request parameter expressions.
 ParamsRequestCondition getMatchingCondition(javax.servlet.http.HttpServletRequest request)
          Returns "this" instance if the request matches all param expressions; or null otherwise.
protected  java.lang.String getToStringInfix()
          The notation to use when printing discrete items of content.
 
Methods inherited from class org.springframework.web.servlet.mvc.condition.AbstractRequestCondition
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParamsRequestCondition

public ParamsRequestCondition(java.lang.String... params)
Create a new instance from the given param expressions.

Parameters:
params - expressions with syntax defined in RequestMapping.params(); if 0, the condition will match to every request.
Method Detail

getExpressions

public java.util.Set<NameValueExpression<java.lang.String>> getExpressions()
Return the contained request parameter expressions.


getContent

protected java.util.Collection<org.springframework.web.servlet.mvc.condition.ParamsRequestCondition.ParamExpression> getContent()
Description copied from class: AbstractRequestCondition
Return the discrete items a request condition is composed of. For example URL patterns, HTTP request methods, param expressions, etc.

Specified by:
getContent in class AbstractRequestCondition<ParamsRequestCondition>
Returns:
a collection of objects, never null

getToStringInfix

protected java.lang.String getToStringInfix()
Description copied from class: AbstractRequestCondition
The notation to use when printing discrete items of content. For example " || " for URL patterns or " && " for param expressions.

Specified by:
getToStringInfix in class AbstractRequestCondition<ParamsRequestCondition>

combine

public ParamsRequestCondition combine(ParamsRequestCondition other)
Returns a new instance with the union of the param expressions from "this" and the "other" instance.

Parameters:
other - the condition to combine with.
Returns:
a request condition instance that is the result of combining the two condition instances.

getMatchingCondition

public ParamsRequestCondition getMatchingCondition(javax.servlet.http.HttpServletRequest request)
Returns "this" instance if the request matches all param expressions; or null otherwise.

Returns:
a condition instance in case of a match; or null if there is no match.

compareTo

public int compareTo(ParamsRequestCondition other,
                     javax.servlet.http.HttpServletRequest request)
Returns:

It is assumed that both instances have been obtained via getMatchingCondition(HttpServletRequest) and each instance contains the matching parameter expressions only or is otherwise empty.


Spring Framework