Class WildcardUtil


  • public final class WildcardUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean anyMatch​(@NotNull java.util.Collection<? extends INameable> values, @NotNull java.lang.String regex)
      Checks if any of the given values matches the given regex.
      static boolean anyMatch​(@NotNull java.util.Collection<? extends INameable> values, @NotNull java.lang.String regex, boolean caseSensitive)
      Checks if any of the given values matches the given regex.
      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 given inputValues which are matching the given pattern.
      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 given inputValues which are matching the given pattern.
      protected static @NotNull java.lang.String fixUnclosedGroups​(@NotNull java.lang.String patternInput)
      Searches for unclosed groups in the given patternInput and replaces the group openers ( with an escaped \( while taking care of completed groups.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 given inputValues which are matching the given pattern.
        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 given values matches the given regex.
        Parameters:
        values - the values to search trough.
        regex - the regex to use for searching.
        Returns:
        true if 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 given inputValues which are matching the given pattern.
        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 given values matches the given regex.
        Parameters:
        values - the values to search trough.
        regex - the regex to use for searching.
        caseSensitive - if the search should be case sensitive.
        Returns:
        true if 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 given patternInput and 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.