Class RegexStringFilter

  • All Implemented Interfaces:

    public class RegexStringFilter
    extends java.lang.Object
    implements Filter<java.lang.String>
    A filter which uses a regular expression to match Strings. Invalid regular expressions will match nothing.

    Because regular expression matching is slow, and a common usage is to match some sort of relative file path, the regular expression is checked to see if it can be evaluated using much faster calls to String.endsWith(String).

    • Field Summary

      Modifier and Type Field Description
      protected java.lang.String endsWith  
      protected java.util.regex.Pattern pattern  
      protected java.lang.String regex  
    • Constructor Summary

      Constructor Description
      RegexStringFilter​(java.lang.String regex)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean filter​(java.lang.String obj)  
      java.lang.String getEndsWith()  
      java.lang.String getRegex()  
      protected void optimize()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • regex

        protected java.lang.String regex
      • pattern

        protected java.util.regex.Pattern pattern
      • endsWith

        protected java.lang.String endsWith
    • Constructor Detail

      • RegexStringFilter

        public RegexStringFilter​(java.lang.String regex)
    • Method Detail

      • getRegex

        public java.lang.String getRegex()
      • getEndsWith

        public java.lang.String getEndsWith()
      • optimize

        protected void optimize()
      • filter

        public boolean filter​(java.lang.String obj)
        Specified by:
        filter in interface Filter<java.lang.String>
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object