Class SimpMessageTypeMessageCondition
- java.lang.Object
- org.springframework.messaging.handler.AbstractMessageCondition<SimpMessageTypeMessageCondition>
- org.springframework.messaging.simp.SimpMessageTypeMessageCondition
- All Implemented Interfaces:
MessageCondition<SimpMessageTypeMessageCondition>
public class SimpMessageTypeMessageCondition extends AbstractMessageCondition<SimpMessageTypeMessageCondition>
MessageCondition
that matches by the message type obtained viaSimpMessageHeaderAccessor.getMessageType(Map)
.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
Field Summary
Fields Modifier and Type Field Description static SimpMessageTypeMessageCondition
MESSAGE
static SimpMessageTypeMessageCondition
SUBSCRIBE
Constructor Summary
Constructors Constructor Description SimpMessageTypeMessageCondition(SimpMessageType messageType)
A constructor accepting a message type.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpMessageTypeMessageCondition
combine(SimpMessageTypeMessageCondition other)
Define the rules for combining this condition with another.int
compareTo(SimpMessageTypeMessageCondition other, Message<?> message)
Compare this condition to another in the context of a specific message.protected Collection<?>
getContent()
Return the collection of objects the message condition is composed of (e.g.SimpMessageTypeMessageCondition
getMatchingCondition(Message<?> message)
Check if this condition matches the given Message and returns a potentially new condition with content tailored to the current message.SimpMessageType
getMessageType()
protected String
getToStringInfix()
The notation to use when printing discrete items of content.Methods inherited from class org.springframework.messaging.handler.AbstractMessageCondition
equals, hashCode, toString
Field Detail
MESSAGE
public static final SimpMessageTypeMessageCondition MESSAGE
SUBSCRIBE
public static final SimpMessageTypeMessageCondition SUBSCRIBE
Constructor Detail
SimpMessageTypeMessageCondition
public SimpMessageTypeMessageCondition(SimpMessageType messageType)
A constructor accepting a message type.- Parameters:
messageType
- the message type to match messages to
Method Detail
getMessageType
public SimpMessageType getMessageType()
getContent
protected Collection<?> getContent()
Description copied from class:AbstractMessageCondition
Return the collection of objects the message condition is composed of (e.g. destination patterns), nevernull
.- Specified by:
getContent
in classAbstractMessageCondition<SimpMessageTypeMessageCondition>
getToStringInfix
protected String getToStringInfix()
Description copied from class:AbstractMessageCondition
The notation to use when printing discrete items of content. For example " || " for URL patterns or " && " for param expressions.- Specified by:
getToStringInfix
in classAbstractMessageCondition<SimpMessageTypeMessageCondition>
combine
public SimpMessageTypeMessageCondition combine(SimpMessageTypeMessageCondition other)
Description copied from interface:MessageCondition
Define the rules for combining this condition with another. For example combining type- and method-level conditions.- Parameters:
other
- the condition to combine with- Returns:
- the resulting message condition
getMatchingCondition
@Nullable public SimpMessageTypeMessageCondition getMatchingCondition(Message<?> message)
Description copied from interface:MessageCondition
Check if this condition matches the given Message and returns a potentially new condition with content tailored to the current message. For example a condition with destination patterns might return a new condition with sorted, matching patterns only.- Returns:
- a condition instance in case of a match; or
null
if there is no match.
compareTo
public int compareTo(SimpMessageTypeMessageCondition other, Message<?> message)
Description copied from interface:MessageCondition
Compare this condition to another in the context of a specific message. It is assumed both instances have been obtained viaMessageCondition.getMatchingCondition(Message)
to ensure they have content relevant to current message only.