Package de.dytanic.cloudnet.common
Class WildcardUtil
- java.lang.Object
-
- de.dytanic.cloudnet.common.WildcardUtil
-
public final class WildcardUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleananyMatch(@NotNull java.util.Collection<? extends INameable> values, @NotNull java.lang.String regex)Checks if any of the givenvaluesmatches the givenregex.static booleananyMatch(@NotNull java.util.Collection<? extends INameable> values, @NotNull java.lang.String regex, boolean caseSensitive)Checks if any of the givenvaluesmatches the givenregex.static <T extends INameable>
@NotNull java.util.Collection<T>filterWildcard(@NotNull java.util.Collection<T> inputValues, @NotNull java.lang.String regex)Filters all values out of the giveninputValueswhich are matching the givenpattern.static <T extends INameable>
@NotNull java.util.Collection<T>filterWildcard(@NotNull java.util.Collection<T> inputValues, @NotNull java.lang.String regex, boolean caseSensitive)Filters all values out of the giveninputValueswhich are matching the givenpattern.protected static @NotNull java.lang.StringfixUnclosedGroups(@NotNull java.lang.String patternInput)Searches for unclosed groups in the givenpatternInputand replaces the group openers ( with an escaped \( while taking care of completed groups.
-
-
-
Method Detail
-
filterWildcard
@NotNull public static <T extends INameable> @NotNull java.util.Collection<T> filterWildcard(@NotNull @NotNull java.util.Collection<T> inputValues, @NotNull @NotNull java.lang.String regex)
Filters all values out of the giveninputValueswhich are matching the givenpattern.- Type Parameters:
T- the type of the input values.- Parameters:
inputValues- the input values to search trough.regex- the regex to use for searching.- Returns:
- all input values matching the given pattern.
- See Also:
filterWildcard(Collection, String, boolean)
-
anyMatch
public static boolean anyMatch(@NotNull @NotNull java.util.Collection<? extends INameable> values, @NotNull @NotNull java.lang.String regex)Checks if any of the givenvaluesmatches the givenregex.- Parameters:
values- the values to search trough.regex- the regex to use for searching.- Returns:
trueif any of the values matches the given regex.- See Also:
anyMatch(Collection, String, boolean)
-
filterWildcard
@NotNull public static <T extends INameable> @NotNull java.util.Collection<T> filterWildcard(@NotNull @NotNull java.util.Collection<T> inputValues, @NotNull @NotNull java.lang.String regex, boolean caseSensitive)
Filters all values out of the giveninputValueswhich are matching the givenpattern.- Type Parameters:
T- the type of the input values.- Parameters:
inputValues- the input values to search trough.regex- the regex to use for searching.caseSensitive- if the search should be case sensitive.- Returns:
- all input values matching the given pattern.
-
anyMatch
public static boolean anyMatch(@NotNull @NotNull java.util.Collection<? extends INameable> values, @NotNull @NotNull java.lang.String regex, boolean caseSensitive)Checks if any of the givenvaluesmatches the givenregex.- Parameters:
values- the values to search trough.regex- the regex to use for searching.caseSensitive- if the search should be case sensitive.- Returns:
trueif any of the values matches the given regex.
-
fixUnclosedGroups
@NotNull @VisibleForTesting protected static @NotNull java.lang.String fixUnclosedGroups(@NotNull @NotNull java.lang.String patternInput)Searches for unclosed groups in the givenpatternInputand replaces the group openers ( with an escaped \( while taking care of completed groups.- Parameters:
patternInput- the pattern to check.- Returns:
- the same pattern as given but with fixed groups.
-
-