public final class SimpDestinationMessageMatcher extends java.lang.Object implements MessageMatcher<java.lang.Object>
MessageMatcher which compares a pre-defined pattern against the destination of a
Message
. There is also support for optionally matching on a specified
SimpMessageType
.
Modifier and Type | Field and Description |
---|---|
static MessageMatcher<java.lang.Object> |
NULL_DESTINATION_MATCHER |
ANY_MESSAGE
Constructor and Description |
---|
SimpDestinationMessageMatcher(java.lang.String pattern)
Creates a new instance with the specified pattern, null
SimpMessageType
(matches any type), and a AntPathMatcher created from the default
constructor. |
SimpDestinationMessageMatcher(java.lang.String pattern,
org.springframework.util.PathMatcher pathMatcher)
Creates a new instance with the specified pattern and
PathMatcher . |
Modifier and Type | Method and Description |
---|---|
static SimpDestinationMessageMatcher |
createMessageMatcher(java.lang.String pattern,
org.springframework.util.PathMatcher matcher)
Creates a new instance with the specified pattern,
SimpMessageType.MESSAGE ,
and PathMatcher . |
static SimpDestinationMessageMatcher |
createSubscribeMatcher(java.lang.String pattern,
org.springframework.util.PathMatcher matcher)
Creates a new instance with the specified pattern,
SimpMessageType.SUBSCRIBE , and PathMatcher . |
MessageMatcher<java.lang.Object> |
getMessageTypeMatcher() |
boolean |
matches(org.springframework.messaging.Message<? extends java.lang.Object> message)
Returns true if the
Message matches, else false |
java.lang.String |
toString() |
public static final MessageMatcher<java.lang.Object> NULL_DESTINATION_MATCHER
public SimpDestinationMessageMatcher(java.lang.String pattern)
Creates a new instance with the specified pattern, null SimpMessageType
(matches any type), and a AntPathMatcher
created from the default
constructor.
The mapping matches destinations despite the using the following rules:
Some examples:
com/t?st.jsp
- matches com/test
but also com/tast
or
com/txst
com/*suffix
- matches all files ending in suffix
in the
com
directorycom/**/test
- matches all destinations ending with test
underneath the com
pathpattern
- the pattern to usepublic SimpDestinationMessageMatcher(java.lang.String pattern, org.springframework.util.PathMatcher pathMatcher)
Creates a new instance with the specified pattern and PathMatcher
.
pattern
- the pattern to usepathMatcher
- the PathMatcher
to use.public boolean matches(org.springframework.messaging.Message<? extends java.lang.Object> message)
MessageMatcher
Message
matches, else falsematches
in interface MessageMatcher<java.lang.Object>
message
- the Message
to match onMessage
matches, else falsepublic MessageMatcher<java.lang.Object> getMessageTypeMatcher()
public java.lang.String toString()
toString
in class java.lang.Object
public static SimpDestinationMessageMatcher createSubscribeMatcher(java.lang.String pattern, org.springframework.util.PathMatcher matcher)
Creates a new instance with the specified pattern,
SimpMessageType.SUBSCRIBE
, and PathMatcher
.
pattern
- the pattern to usematcher
- the PathMatcher
to use.public static SimpDestinationMessageMatcher createMessageMatcher(java.lang.String pattern, org.springframework.util.PathMatcher matcher)
Creates a new instance with the specified pattern, SimpMessageType.MESSAGE
,
and PathMatcher
.
pattern
- the pattern to usematcher
- the PathMatcher
to use.