类 CompositeRequestCondition
- java.lang.Object
- org.springframework.web.servlet.mvc.condition.AbstractRequestCondition<CompositeRequestCondition>
- org.springframework.web.servlet.mvc.condition.CompositeRequestCondition
- 所有已实现的接口:
RequestCondition<CompositeRequestCondition>
public class CompositeRequestCondition extends AbstractRequestCondition<CompositeRequestCondition>
Implements theRequestConditioncontract by delegating to multipleRequestConditiontypes and using a logical conjunction (' && ') to ensure all conditions match a given request.When
CompositeRequestConditioninstances are combined or compared they are expected to (a) contain the same number of conditions and (b) that conditions in the respective index are of the same type. It is acceptable to providenullconditions or no conditions at all to the constructor.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 CompositeRequestCondition(RequestCondition<?>... requestConditions)Create an instance with 0 or moreRequestConditiontypes.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 CompositeRequestConditioncombine(CompositeRequestCondition other)If one instance is empty, return the other.intcompareTo(CompositeRequestCondition other, HttpServletRequest request)If one instance is empty, the other "wins".List<RequestCondition<?>>getConditions()Return the underlying conditions (possibly empty but nevernull).protected Collection<?>getContent()Return the discrete items a request condition is composed of.CompositeRequestConditiongetMatchingCondition(HttpServletRequest request)Delegate to all contained conditions to match the request and return the resulting "matching" condition instances.protected StringgetToStringInfix()The notation to use when printing discrete items of content.booleanisEmpty()Whether this instance contains 0 conditions or not.从类继承的方法 org.springframework.web.servlet.mvc.condition.AbstractRequestCondition
equals, hashCode, toString
构造器详细资料
CompositeRequestCondition
public CompositeRequestCondition(RequestCondition<?>... requestConditions)
Create an instance with 0 or moreRequestConditiontypes. It is important to createCompositeRequestConditioninstances with the same number of conditions so they may be compared and combined. It is acceptable to providenullconditions.
方法详细资料
isEmpty
public boolean isEmpty()
Whether this instance contains 0 conditions or not.- 覆盖:
isEmpty在类中AbstractRequestCondition<CompositeRequestCondition>- 返回:
trueif empty;falseotherwise
getConditions
public List<RequestCondition<?>> getConditions()
Return the underlying conditions (possibly empty but nevernull).
getContent
protected Collection<?> getContent()
从类复制的说明:AbstractRequestConditionReturn the discrete items a request condition is composed of.For example URL patterns, HTTP request methods, param expressions, etc.
- 指定者:
getContent在类中AbstractRequestCondition<CompositeRequestCondition>- 返回:
- a collection of objects (never
null)
getToStringInfix
protected String getToStringInfix()
从类复制的说明:AbstractRequestConditionThe notation to use when printing discrete items of content.For example
" || "for URL patterns or" && "for param expressions.
combine
public CompositeRequestCondition combine(CompositeRequestCondition other)
If one instance is empty, return the other. If both instances have conditions, combine the individual conditions after ensuring they are of the same type and number.- 参数:
other- the condition to combine with.- 返回:
- a request condition instance that is the result of combining the two condition instances.
getMatchingCondition
@Nullable public CompositeRequestCondition getMatchingCondition(HttpServletRequest request)
Delegate to all contained conditions to match the request and return the resulting "matching" condition instances.An empty
CompositeRequestConditionmatches to all requests.- 返回:
- a condition instance in case of a match or
nullotherwise.
compareTo
public int compareTo(CompositeRequestCondition other, HttpServletRequest request)
If one instance is empty, the other "wins". If both instances have conditions, compare them in the order in which they were provided.