public class CommandNameFilter extends Object implements CommandMessageFilter
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() |
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)
CommandMessageFilter
commandMessage
matches this filter.matches
in interface CommandMessageFilter
commandMessage
- The message to matchtrue
if the command matches, otherwise false
public CommandMessageFilter negate()
CommandMessageFilter
negate
in interface CommandMessageFilter
public CommandMessageFilter and(CommandMessageFilter other)
CommandMessageFilter
other
match.and
in interface CommandMessageFilter
other
- The other filter to match againstpublic CommandMessageFilter or(CommandMessageFilter other)
CommandMessageFilter
other
matches.or
in interface CommandMessageFilter
other
- the other filter to match againstCopyright © 2010–2020. All rights reserved.