net.sourceforge.pmd.util.filter
Class RegexStringFilter

java.lang.Object
  extended by net.sourceforge.pmd.util.filter.RegexStringFilter
All Implemented Interfaces:
Filter<String>

public class RegexStringFilter
extends Object
implements Filter<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
protected  String endsWith
           
protected  Pattern pattern
           
protected  String regex
           
 
Constructor Summary
RegexStringFilter(String regex)
           
 
Method Summary
 boolean filter(String obj)
           
 String getEndsWith()
           
 String getRegex()
           
protected  void optimize()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

regex

protected String regex

pattern

protected Pattern pattern

endsWith

protected String endsWith
Constructor Detail

RegexStringFilter

public RegexStringFilter(String regex)
Method Detail

getRegex

public String getRegex()

getEndsWith

public String getEndsWith()

optimize

protected void optimize()

filter

public boolean filter(String obj)
Specified by:
filter in interface Filter<String>

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2015 InfoEther. All Rights Reserved.