org.jjoost.util.filters
Class FilterPattern

java.lang.Object
  extended by org.jjoost.util.filters.FilterPattern
All Implemented Interfaces:
java.io.Serializable, Filter<java.lang.String>

public class FilterPattern
extends java.lang.Object
implements Filter<java.lang.String>

A filter accepting strings that match the provided pattern

Author:
b.elliottsmith
See Also:
Serialized Form

Constructor Summary
FilterPattern(java.util.regex.Pattern pattern)
          Constructs a new filter accepting strings that match the provided pattern
FilterPattern(java.lang.String pattern)
          Constructs a new filter accepting strings that match the provided pattern
 
Method Summary
 boolean accept(java.lang.String test)
          Returns true if the Filter accepts the parameter and false otherwise
static FilterPattern get(java.util.regex.Pattern pattern)
          Returns a filter accepting strings that match the provided pattern
static FilterPattern get(java.lang.String pattern)
          Returns a filter accepting strings that match the provided pattern
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilterPattern

public FilterPattern(java.util.regex.Pattern pattern)
Constructs a new filter accepting strings that match the provided pattern

Parameters:
pattern - the pattern to filter by

FilterPattern

public FilterPattern(java.lang.String pattern)
Constructs a new filter accepting strings that match the provided pattern

Parameters:
pattern - the pattern to filter by
Method Detail

accept

public boolean accept(java.lang.String test)
Description copied from interface: Filter
Returns true if the Filter accepts the parameter and false otherwise

Specified by:
accept in interface Filter<java.lang.String>
Parameters:
test - value to test
Returns:
true if the filter accepts test; false otherwise

toString

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

get

public static FilterPattern get(java.util.regex.Pattern pattern)
Returns a filter accepting strings that match the provided pattern

Parameters:
pattern - the pattern to filter by
Returns:
a filter accepting strings that match the provided pattern

get

public static FilterPattern get(java.lang.String pattern)
Returns a filter accepting strings that match the provided pattern

Parameters:
pattern - the pattern to filter by
Returns:
a filter accepting strings that match the provided pattern