Class CompositeCustomRequestCondition
java.lang.Object
org.springframework.web.servlet.mvc.condition.AbstractRequestCondition<CompositeCustomRequestCondition>
com.foreach.across.modules.web.mvc.condition.CompositeCustomRequestCondition
- All Implemented Interfaces:
org.springframework.web.servlet.mvc.condition.RequestCondition<CompositeCustomRequestCondition>
public final class CompositeCustomRequestCondition
extends org.springframework.web.servlet.mvc.condition.AbstractRequestCondition<CompositeCustomRequestCondition>
Collection of
CustomRequestCondition
with different semantics than
the CompositeRequestCondition
. When combining,
this implementation will merge the collections. Condition types existing on both ends will be combined, else
it will be added to the resulting collection.
Only a single condition of the same type is allowed in the collection. An exception will be thrown if more
than one condition of the same type is added.
This condition only matches if all of its members match.- Since:
- 2.0.0
- Author:
- Marc Vanbrabant, Arne Vandamme
-
Constructor Summary
ConstructorDescriptionCreate a new empty condition. -
Method Summary
Modifier and TypeMethodDescriptionIf one instance is empty, return the other.int
compareTo
(CompositeCustomRequestCondition other, jakarta.servlet.http.HttpServletRequest request) If one instance is empty, the other "wins".protected Collection<CustomRequestCondition>
getMatchingCondition
(jakarta.servlet.http.HttpServletRequest request) protected String
boolean
isEmpty()
Methods inherited from class org.springframework.web.servlet.mvc.condition.AbstractRequestCondition
equals, hashCode, toString
-
Constructor Details
-
CompositeCustomRequestCondition
public CompositeCustomRequestCondition()Create a new empty condition. Can be used withcombine(CompositeCustomRequestCondition)
and will match any request. -
CompositeCustomRequestCondition
-
-
Method Details
-
combine
If one instance is empty, return the other. If both instances have conditions, combine the conditions of the same type, add all others. -
getMatchingCondition
public CompositeCustomRequestCondition getMatchingCondition(jakarta.servlet.http.HttpServletRequest request) -
compareTo
public int compareTo(CompositeCustomRequestCondition other, jakarta.servlet.http.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. A condition with more members always has precedence over one with fewer, as it is considered to be a more specific match. -
isEmpty
public boolean isEmpty()- Overrides:
isEmpty
in classorg.springframework.web.servlet.mvc.condition.AbstractRequestCondition<CompositeCustomRequestCondition>
-
getContent
- Specified by:
getContent
in classorg.springframework.web.servlet.mvc.condition.AbstractRequestCondition<CompositeCustomRequestCondition>
-
getToStringInfix
- Specified by:
getToStringInfix
in classorg.springframework.web.servlet.mvc.condition.AbstractRequestCondition<CompositeCustomRequestCondition>
-