public class DenyCommandNameFilter extends Object implements CommandMessageFilter
CommandMessageFilter
implementation which denies CommandMessage
s based on their CommandMessage.getCommandName()
. It can be combined with other CommandMessageFilter
instances in an
efficient manner.Constructor and Description |
---|
DenyCommandNameFilter(Set<String> commandNames)
Initializes a
DenyCommandNameFilter from the given set of commandNames . |
DenyCommandNameFilter(String commandName)
Initializes a
DenyCommandNameFilter for a single commandName . |
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 |
or(CommandMessageFilter other)
Returns a filter that matches when either this instance or the given
other matches. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
negate
@ConstructorProperties(value="commandNames") public DenyCommandNameFilter(Set<String> commandNames)
DenyCommandNameFilter
from the given set of commandNames
. Commands with a name that
is present in this set will be blocked by this filter.commandNames
- the names of commands blocked by this filterpublic DenyCommandNameFilter(String commandName)
DenyCommandNameFilter
for a single commandName
. Commands with a name equal to the
given commandName will be blocked by this filter.commandName
- the name of the command blocked by this filterpublic boolean matches(@Nonnull CommandMessage<?> commandMessage)
CommandMessageFilter
commandMessage
matches this filter.matches
in interface CommandMessageFilter
commandMessage
- the message to matchtrue
if the command matches, otherwise false
public CommandMessageFilter and(@Nonnull CommandMessageFilter other)
CommandMessageFilter
other
match.and
in interface CommandMessageFilter
other
- the other filter to match againstpublic CommandMessageFilter or(@Nonnull CommandMessageFilter other)
CommandMessageFilter
other
matches.or
in interface CommandMessageFilter
other
- the other filter to match againstCopyright © 2010–2024. All rights reserved.