Top Description Fields Constructors Methods
org.springframework.web.reactive.result.condition

public Class CompositeRequestCondition

extends AbstractRequestCondition<CompositeRequestCondition>
Class Inheritance
Imports
java.util.ArrayList, .Collection, .Collections, .List, org.springframework.lang.Nullable, org.springframework.util.Assert, .ObjectUtils, org.springframework.web.server.ServerWebExchange

Implements the RequestCondition contract by delegating to multiple RequestCondition types and using a logical conjunction (' && ') to ensure all conditions match a given request.

When CompositeRequestCondition instances are combined or compared is expected that (a) they contain the same number of conditions and (b) conditions at the same index are of the same type. It is acceptable to provide null conditions or no conditions at all to the constructor.

Author
Rossen Stoyanchev
Since
5.0

Field Summary

Modifier and TypeField and Description
private final RequestConditionHolder[]

Constructor Summary

AccessConstructor and Description
public
CompositeRequestCondition(RequestCondition<?>... requestConditions)

Create an instance with 0 or more RequestCondition types.

private

Method Summary

Modifier and TypeMethod and Description
private void
public CompositeRequestCondition
combine(CompositeRequestCondition
the condition to combine with.
other
)

Implements org.springframework.web.reactive.result.condition.RequestCondition.combine.

If one instance is empty, return the other.

public int
public List<RequestCondition<?>>
getConditions()

Return the underlying conditions, possibly empty but never null.

protected Collection<?>
getContent()

Implements abstract org.springframework.web.reactive.result.condition.AbstractRequestCondition.getContent.

Return the discrete items a request condition is composed of.

private int
public CompositeRequestCondition
getMatchingCondition(ServerWebExchange exchange)

Implements org.springframework.web.reactive.result.condition.RequestCondition.getMatchingCondition.

Delegate to all contained conditions to match the request and return the resulting "matching" condition instances.

protected String
getToStringInfix()

Implements abstract org.springframework.web.reactive.result.condition.AbstractRequestCondition.getToStringInfix.

The notation to use when printing discrete items of content.

public boolean
isEmpty()

Overrides org.springframework.web.reactive.result.condition.AbstractRequestCondition.isEmpty.

Whether this instance contains 0 conditions or not.

private List<RequestCondition<?>>
private RequestConditionHolder[]
wrap(RequestCondition<?>... rawConditions)

Inherited from org.springframework.web.reactive.result.condition.AbstractRequestCondition:
equalshashCodetoString

Field Detail

requestConditionsback to summary
private final RequestConditionHolder[] requestConditions

Constructor Detail

CompositeRequestConditionback to summary
public CompositeRequestCondition(RequestCondition<?>... requestConditions)

Create an instance with 0 or more RequestCondition types. It is important to create CompositeRequestCondition instances with the same number of conditions so they may be compared and combined. It is acceptable to provide null conditions.

CompositeRequestConditionback to summary
private CompositeRequestCondition(RequestConditionHolder[] requestConditions)

Method Detail

assertNumberOfConditionsback to summary
private void assertNumberOfConditions(CompositeRequestCondition other)
combineback to summary
public CompositeRequestCondition combine(CompositeRequestCondition other)

Implements org.springframework.web.reactive.result.condition.RequestCondition.combine.

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.

Parameters
other:CompositeRequestCondition

Doc from org.springframework.web.reactive.result.condition.RequestCondition.combine.

the condition to combine with.

Returns:CompositeRequestCondition

Doc from org.springframework.web.reactive.result.condition.RequestCondition.combine.

a request condition instance that is the result of combining the two condition instances.

Annotations
@Override
compareToback to summary
public int compareTo(CompositeRequestCondition other, ServerWebExchange exchange)

Implements org.springframework.web.reactive.result.condition.RequestCondition.compareTo.

If one instance is empty, the other "wins". If both instances have conditions, compare them in the order in which they were provided.

Annotations
@Override
getConditionsback to summary
public List<RequestCondition<?>> getConditions()

Return the underlying conditions, possibly empty but never null.

getContentback to summary
protected Collection<?> getContent()

Implements abstract org.springframework.web.reactive.result.condition.AbstractRequestCondition.getContent.

Doc from org.springframework.web.reactive.result.condition.AbstractRequestCondition.getContent.

Return the discrete items a request condition is composed of.

For example URL patterns, HTTP request methods, param expressions, etc.

Returns:Collection<?>

a collection of objects (never null)

Annotations
@Override
getLengthback to summary
private int getLength()
getMatchingConditionback to summary
public CompositeRequestCondition getMatchingCondition(ServerWebExchange exchange)

Implements org.springframework.web.reactive.result.condition.RequestCondition.getMatchingCondition.

Delegate to all contained conditions to match the request and return the resulting "matching" condition instances.

An empty CompositeRequestCondition matches to all requests.

Returns:CompositeRequestCondition

Doc from org.springframework.web.reactive.result.condition.RequestCondition.getMatchingCondition.

a condition instance in case of a match or null otherwise.

Annotations
@Override
@Nullable
getToStringInfixback to summary
protected String getToStringInfix()

Implements abstract org.springframework.web.reactive.result.condition.AbstractRequestCondition.getToStringInfix.

Doc from org.springframework.web.reactive.result.condition.AbstractRequestCondition.getToStringInfix.

The notation to use when printing discrete items of content.

For example " || " for URL patterns or " && " for param expressions.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides org.springframework.web.reactive.result.condition.AbstractRequestCondition.isEmpty.

Whether this instance contains 0 conditions or not.

Returns:boolean

Doc from org.springframework.web.reactive.result.condition.AbstractRequestCondition.isEmpty.

true if empty; false otherwise

Annotations
@Override
unwrapback to summary
private List<RequestCondition<?>> unwrap()
wrapback to summary
private RequestConditionHolder[] wrap(RequestCondition<?>... rawConditions)