Class AbstractCommandFilter
- java.lang.Object
-
- com.jtelegram.api.commands.filters.AbstractCommandFilter
-
- All Implemented Interfaces:
CommandFilter
- Direct Known Subclasses:
ChatTypeFilter
,MentionFilter
,RegexFilter
,RootFilter
,TextFilter
public abstract class AbstractCommandFilter extends java.lang.Object implements CommandFilter
An abstract implementation ofCommandFilter
-
-
Constructor Summary
Constructors Constructor Description AbstractCommandFilter(CommandFilter... children)
Creates a CommandFilter with given children.
All subclasses of CommandFilter are expected to support multiple children filters (except CommandHandler, which is a special case).
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
preTest(TextMessageEvent event, Command command)
boolean
test(TextMessageEvent event, Command command)
Checks to see if the given event and command test to betrue
according to this filter.
-
-
-
Constructor Detail
-
AbstractCommandFilter
public AbstractCommandFilter(CommandFilter... children)
Creates a CommandFilter with given children.
All subclasses of CommandFilter are expected to support multiple children filters (except CommandHandler, which is a special case).- Parameters:
children
- The children filters, which will be checked in order if this filter tests to betrue
-
-
Method Detail
-
preTest
protected abstract boolean preTest(TextMessageEvent event, Command command)
-
test
public final boolean test(TextMessageEvent event, Command command)
Description copied from interface:CommandFilter
Checks to see if the given event and command test to betrue
according to this filter.- Specified by:
test
in interfaceCommandFilter
- Parameters:
event
- The event to be testedcommand
- The command data executed in this event- Returns:
- True if and only if this filter allows this event and command combination to go ahead.
-
-