Class StringFilter
- java.lang.Object
-
- com.github.siroshun09.mccommand.common.filter.AbstractFilter<String>
-
- com.github.siroshun09.mccommand.common.filter.StringFilter
-
public final class StringFilter extends AbstractFilter<String>
-
-
Field Summary
Fields Modifier and Type Field Description static StringFilterIS_EMPTYThe filter if theStringis empty.static StringFilterIS_NOT_EMPTYThe filter if theStringis not empty.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @NotNull StringFiltercreate(@NotNull Predicate<String> predicate)Creates theStringFilter.static @NotNull StringFilterendsWith(@NotNull String suffix)static @NotNull StringFilterendsWithIgnoreCase(@NotNull String suffix)static @NotNull StringFilterlengthRange(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int min, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int max)Creates a filter to check the length ofString.static @NotNull StringFiltermaxLength(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int max)Creates a filter to check the length ofString.static @NotNull StringFilterminLength(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int min)Creates a filter to check the length ofString.static @NotNull StringFilterregex(@NotNull String regex)Create a filter using a regular expression.static @NotNull StringFilterregex(@NotNull Pattern pattern)Create a filter using aPattern.static @NotNull StringFilterstartsWith(@NotNull String prefix)static @NotNull StringFilterstartsWithIgnoreCase(@NotNull String prefix)-
Methods inherited from class com.github.siroshun09.mccommand.common.filter.AbstractFilter
test
-
-
-
-
Field Detail
-
IS_EMPTY
public static final StringFilter IS_EMPTY
The filter if theStringis empty.
-
IS_NOT_EMPTY
public static final StringFilter IS_NOT_EMPTY
The filter if theStringis not empty.
-
-
Method Detail
-
create
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter create(@NotNull @NotNull Predicate<String> predicate)Creates theStringFilter.- Parameters:
predicate- the predicate to test theString- Returns:
- the
StringFilter
-
startsWith
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter startsWith(@NotNull @NotNull String prefix)- Parameters:
prefix- the prefix- Returns:
- the
StringFilter
-
startsWithIgnoreCase
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter startsWithIgnoreCase(@NotNull @NotNull String prefix)Creates a filter to check if theStringstarts with the specifiedString.This filter is not case-sensitive.
- Parameters:
prefix- the prefix- Returns:
- the
StringFilter
-
endsWith
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter endsWith(@NotNull @NotNull String suffix)- Parameters:
suffix- the suffix- Returns:
- the
StringFilter
-
endsWithIgnoreCase
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter endsWithIgnoreCase(@NotNull @NotNull String suffix)Creates a filter to check if theStringends with the specifiedString.This filter is not case-sensitive.
- Parameters:
suffix- the suffix- Returns:
- the
StringFilter
-
lengthRange
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter lengthRange(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int min, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int max) throws IllegalArgumentExceptionCreates a filter to check the length ofString.- Parameters:
min- minimum lengthmax- maximum length- Returns:
- the
StringFilter - Throws:
IllegalArgumentException- if the minimum or maximum value is less than zero or if the minimum value is greater than the maximum value
-
maxLength
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter maxLength(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int max)Creates a filter to check the length ofString.- Parameters:
max- maximum length- Returns:
- the
StringFilter - Throws:
IllegalArgumentException- if the maximum value is less than zero
-
minLength
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter minLength(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int min)Creates a filter to check the length ofString.- Parameters:
min- minimum length- Returns:
- the
StringFilter - Throws:
IllegalArgumentException- if the minimum value is less than zero
-
regex
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter regex(@NotNull @NotNull String regex)Create a filter using a regular expression.- Parameters:
regex- the regex- Returns:
- the
StringFilter
-
regex
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull StringFilter regex(@NotNull @NotNull Pattern pattern)Create a filter using aPattern.- Parameters:
pattern- the pattern- Returns:
- the
StringFilter
-
-