spring-framework / org.springframework.messaging.handler / DestinationPatternsMessageCondition

DestinationPatternsMessageCondition

open class DestinationPatternsMessageCondition : AbstractMessageCondition<DestinationPatternsMessageCondition>

A MessageCondition for matching the destination of a Message against one or more destination patterns using a PathMatcher.

Author
Rossen Stoyanchev

Since
4.0

Constructors

<init>

DestinationPatternsMessageCondition(vararg patterns: String)

Creates a new instance with the given destination patterns. Each pattern that is not empty and does not start with "/" is prepended with "/".

DestinationPatternsMessageCondition(patterns: Array<String>, pathMatcher: PathMatcher)

Alternative constructor accepting a custom PathMatcher.

Properties

LOOKUP_DESTINATION_HEADER

static val LOOKUP_DESTINATION_HEADER: String

Functions

combine

open fun combine(other: DestinationPatternsMessageCondition): DestinationPatternsMessageCondition

Returns a new instance with URL patterns from the current instance ("this") and the "other" instance as follows:

compareTo

open fun compareTo(other: DestinationPatternsMessageCondition, message: Message<*>): Int

Compare the two conditions based on the destination patterns they contain. Patterns are compared one at a time, from top to bottom via org.springframework.util.PathMatcher#getPatternComparator(String). If all compared patterns match equally, but one instance has more patterns, it is considered a closer match.

It is assumed that both instances have been obtained via #getMatchingCondition(Message) to ensure they contain only patterns that match the request and are sorted with the best matches on top.

getMatchingCondition

open fun getMatchingCondition(message: Message<*>): DestinationPatternsMessageCondition

Check if any of the patterns match the given Message destination and return an instance that is guaranteed to contain matching patterns, sorted via org.springframework.util.PathMatcher#getPatternComparator(String).

getPatterns

open fun getPatterns(): MutableSet<String>