Class RegexPreprocessor<C>
java.lang.Object
cloud.commandframework.arguments.preprocessor.RegexPreprocessor<C>
- Type Parameters:
C- Command sender type
- All Implemented Interfaces:
BiFunction<@NonNull CommandContext<C>,@NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult<Boolean>>
public final class RegexPreprocessor<C>
extends Object
implements BiFunction<@NonNull CommandContext<C>,@NonNull Queue<@NonNull String>,@NonNull ArgumentParseResult<Boolean>>
Command preprocessor that filters based on regular expressions
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classException thrown when input fails regex matching inRegexPreprocessor -
Method Summary
Modifier and TypeMethodDescription@NonNull ArgumentParseResult<Boolean>apply(@NonNull CommandContext<C> context, @NonNull Queue<@NonNull String> strings) static <C> @NonNull RegexPreprocessor<C>Create a new preprocessor usingStandardCaptionKeys.ARGUMENT_PARSE_FAILURE_REGEXas the failure captionstatic <C> @NonNull RegexPreprocessor<C>Create a new preprocessorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThen
-
Method Details
-
of
Create a new preprocessor usingStandardCaptionKeys.ARGUMENT_PARSE_FAILURE_REGEXas the failure caption- Type Parameters:
C- Command sender type- Parameters:
pattern- Regular expression- Returns:
- Preprocessor instance
-
of
public static <C> @NonNull RegexPreprocessor<C> of(@NonNull String pattern, @NonNull Caption failureCaption) Create a new preprocessor- Type Parameters:
C- Command sender type- Parameters:
pattern- Regular expressionfailureCaption- Caption sent when the input is invalid- Returns:
- Preprocessor instance
-
apply
public @NonNull ArgumentParseResult<Boolean> apply(@NonNull CommandContext<C> context, @NonNull Queue<@NonNull String> strings) - Specified by:
applyin interfaceBiFunction<@NonNull CommandContext<C>,@NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult<Boolean>>
-