public class CommandNameFilter extends Object implements CommandMessageFilter
CommandMessageFilter implementation which filters CommandMessages by the CommandMessage.getCommandName(). It can be combined with other CommandMessageFilter instances in an
efficient manner.| Constructor and Description |
|---|
CommandNameFilter(Set<String> commandNames)
Initializes a
CommandNameFilter for the given set of commandNames. |
CommandNameFilter(String commandName)
Initializes a
CommandNameFilter for a single command name. |
| Modifier and Type | Method and Description |
|---|---|
CommandMessageFilter |
and(CommandMessageFilter other)
Returns a filter that matches when both this instance and the given
other match. |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
matches(CommandMessage<?> commandMessage)
Indicates whether the given
commandMessage matches this filter. |
CommandMessageFilter |
negate()
Returns a filter that matches when this instance doesn't, and vice versa.
|
CommandMessageFilter |
or(CommandMessageFilter other)
Returns a filter that matches when either this instance or the given
other matches. |
String |
toString() |
@ConstructorProperties(value="commandNames") public CommandNameFilter(Set<String> commandNames)
CommandNameFilter for the given set of commandNames.commandNames - commands that can be handledpublic CommandNameFilter(String commandName)
CommandNameFilter for a single command name.commandName - command that can be handledpublic boolean matches(CommandMessage<?> commandMessage)
CommandMessageFiltercommandMessage matches this filter.matches in interface CommandMessageFiltercommandMessage - the message to matchtrue if the command matches, otherwise falsepublic CommandMessageFilter negate()
CommandMessageFilternegate in interface CommandMessageFilterpublic CommandMessageFilter and(CommandMessageFilter other)
CommandMessageFilterother match.and in interface CommandMessageFilterother - the other filter to match againstpublic CommandMessageFilter or(CommandMessageFilter other)
CommandMessageFilterother matches.or in interface CommandMessageFilterother - the other filter to match againstCopyright © 2010–2022. All rights reserved.