Class RowFilters


  • public class RowFilters
    extends java.lang.Object
    Factory of additional RowFilters.

    Trigger is the missing of Pattern/Regex+matchflags factory method in core. Can't do much other than c&p core as both abstract base class GeneralFilter and concrete RowFilter are private. Expose the base as public for custom subclasses

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  RowFilters.GeneralFilter
      C&P from core Swing to allow subclassing.
      private static class  RowFilters.RegexFilter
      C&P from core to allow richer factory methods.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private RowFilters()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <M,​I>
      javax.swing.RowFilter<M,​I>
      regexFilter​(int matchFlags, java.lang.String regex, int... indices)
      Returns a RowFilter that uses a regular expression to determine which entries to include.
      static <M,​I>
      javax.swing.RowFilter<M,​I>
      regexFilter​(java.lang.String regex, int... indices)
      Returns a RowFilter that uses a regular expression to determine which entries to include.
      static <M,​I>
      javax.swing.RowFilter<M,​I>
      regexFilter​(java.util.regex.Pattern pattern, int... indices)
      Returns a RowFilter that uses a regular expression to determine which entries to include.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RowFilters

        private RowFilters()
    • Method Detail

      • regexFilter

        public static <M,​I> javax.swing.RowFilter<M,​I> regexFilter​(java.lang.String regex,
                                                                               int... indices)
        Returns a RowFilter that uses a regular expression to determine which entries to include. Only entries with at least one matching value are included. For example, the following creates a RowFilter that includes entries with at least one value starting with "a":
           RowFilter.regexFilter("^a");
         

        The returned filter uses Matcher.find() to test for inclusion. To test for exact matches use the characters '^' and '$' to match the beginning and end of the string respectively. For example, "^foo$" includes only rows whose string is exactly "foo" and not, for example, "food". See Pattern for a complete description of the supported regular-expression constructs.

        Parameters:
        regex - the regular expression to filter on
        indices - the indices of the values to check. If not supplied all values are evaluated
        Returns:
        a RowFilter implementing the specified criteria
        Throws:
        java.lang.NullPointerException - if regex is null
        java.lang.IllegalArgumentException - if any of the indices are < 0
        java.util.regex.PatternSyntaxException - if regex is not a valid regular expression.
        See Also:
        Pattern
      • regexFilter

        public static <M,​I> javax.swing.RowFilter<M,​I> regexFilter​(int matchFlags,
                                                                               java.lang.String regex,
                                                                               int... indices)
        Returns a RowFilter that uses a regular expression to determine which entries to include. Only entries with at least one matching value are included. For example, the following creates a RowFilter that includes entries with at least one value starting with "a" ignoring case:
           RowFilter.regexFilter(Pattern.CASE_INSENSITIVE, "^a");
         

        The returned filter uses Matcher.find() to test for inclusion. To test for exact matches use the characters '^' and '$' to match the beginning and end of the string respectively. For example, "^foo$" includes only rows whose string is exactly "foo" and not, for example, "food". See Pattern for a complete description of the supported regular-expression constructs.

        Parameters:
        matchFlags - Match flags, a bit mask that may include Pattern.CASE_INSENSITIVE, Pattern.MULTILINE, Pattern.DOTALL, Pattern.UNICODE_CASE, Pattern.CANON_EQ, Pattern.UNIX_LINES, Pattern.LITERAL and Pattern.COMMENTS
        regex - the regular expression to filter on
        indices - the indices of the values to check. If not supplied all values are evaluated
        Returns:
        a RowFilter implementing the specified criteria
        Throws:
        java.lang.NullPointerException - if regex is null
        java.lang.IllegalArgumentException - if any of the indices are < 0
        java.lang.IllegalArgumentException - If bit values other than those corresponding to the defined match flags are set in flags
        java.util.regex.PatternSyntaxException - if regex is not a valid regular expression.
        See Also:
        Pattern
      • regexFilter

        public static <M,​I> javax.swing.RowFilter<M,​I> regexFilter​(java.util.regex.Pattern pattern,
                                                                               int... indices)
        Returns a RowFilter that uses a regular expression to determine which entries to include.
        Parameters:
        pattern - the Pattern to use for matching
        indices - the indices of the values to check. If not supplied all values are evaluated
        Returns:
        a RowFilter implementing the specified criteria
        Throws:
        java.lang.NullPointerException - if pattern is null
        See Also:
        Pattern