类 RequestConditionHolder
- java.lang.Object
- org.springframework.web.servlet.mvc.condition.AbstractRequestCondition<RequestConditionHolder>
- org.springframework.web.servlet.mvc.condition.RequestConditionHolder
- 所有已实现的接口:
RequestCondition<RequestConditionHolder>
public final class RequestConditionHolder extends AbstractRequestCondition<RequestConditionHolder>
A holder for aRequestCondition
useful when the type of the request condition is not known ahead of time, e.g. custom condition. Since this class is also an implementation ofRequestCondition
, effectively it decorates the held request condition and allows it to be combined and compared with other request conditions in a type and null safe way.When two
RequestConditionHolder
instances are combined or compared with each other, it is expected the conditions they hold are of the same type. If they are not, aClassCastException
is raised.- 从以下版本开始:
- 3.1
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 RequestConditionHolder(RequestCondition<?> requestCondition)
Create a new holder to wrap the given request condition.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 RequestConditionHolder
combine(RequestConditionHolder other)
Combine the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type.int
compareTo(RequestConditionHolder other, HttpServletRequest request)
Compare the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type.RequestCondition<?>
getCondition()
Return the held request condition, ornull
if not holding one.protected Collection<?>
getContent()
Return the discrete items a request condition is composed of.RequestConditionHolder
getMatchingCondition(HttpServletRequest request)
Get the matching condition for the held request condition wrap it in a new RequestConditionHolder instance.protected String
getToStringInfix()
The notation to use when printing discrete items of content.从类继承的方法 org.springframework.web.servlet.mvc.condition.AbstractRequestCondition
equals, hashCode, isEmpty, toString
构造器详细资料
RequestConditionHolder
public RequestConditionHolder(RequestCondition<?> requestCondition)
Create a new holder to wrap the given request condition.- 参数:
requestCondition
- the condition to hold, may benull
方法详细资料
getCondition
public RequestCondition<?> getCondition()
Return the held request condition, ornull
if not holding one.
getContent
protected Collection<?> getContent()
从类复制的说明:AbstractRequestCondition
Return the discrete items a request condition is composed of.For example URL patterns, HTTP request methods, param expressions, etc.
- 指定者:
getContent
在类中AbstractRequestCondition<RequestConditionHolder>
- 返回:
- a collection of objects (never
null
)
getToStringInfix
protected String getToStringInfix()
从类复制的说明:AbstractRequestCondition
The notation to use when printing discrete items of content.For example
" || "
for URL patterns or" && "
for param expressions.
combine
public RequestConditionHolder combine(RequestConditionHolder other)
Combine the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type. Or if one holder is empty, the other holder is returned.- 参数:
other
- the condition to combine with.- 返回:
- a request condition instance that is the result of combining the two condition instances.
getMatchingCondition
public RequestConditionHolder getMatchingCondition(HttpServletRequest request)
Get the matching condition for the held request condition wrap it in a new RequestConditionHolder instance. Or otherwise if this is an empty holder, return the same holder instance.- 返回:
- a condition instance in case of a match or
null
otherwise.
compareTo
public int compareTo(RequestConditionHolder other, HttpServletRequest request)
Compare the request conditions held by the two RequestConditionHolder instances after making sure the conditions are of the same type. Or if one holder is empty, the other holder is preferred.