com.webmethods.caf.faces.data
Class CollectionUtils.FilterExpression

java.lang.Object
  extended by com.webmethods.caf.faces.data.CollectionUtils.FilterExpression
Enclosing class:
CollectionUtils

public static class CollectionUtils.FilterExpression
extends Object

Filter expression constructed by a string for use by CollectionUtils.filter(Collection, FilterExpression, IFilterableValueDecorator) . The filter expression uses the standard common search keyword rules (* = wildcard, space = and, quotes = exact phrase).


Field Summary
protected  List m_patterns
          List<Pattern> of individual patterns
protected  String m_string
          Expression string.
protected static Pattern RE_EMPTY
          Pattern for matching whitespace, stars, and quotes
protected static Pattern RE_QUOTED
          Pattern for matching anything inside quotes (inclusive)
protected static Pattern RE_WILDCARD
          Wildcard Pattern
 
Constructor Summary
CollectionUtils.FilterExpression(String s)
          Creates a new filter expression object from the specified string.
 
Method Summary
 void filter(Collection collection, CollectionUtils.IFilterableValueDecorator valueDecorator)
          Removes the items from the specified collection whose value does not match the filter.
 String getExpressionString()
          Expression string.
 boolean matches(String s)
          True if the specified string matches this expression.
 void setExpressionString(String s)
          Expression string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RE_EMPTY

protected static Pattern RE_EMPTY
Pattern for matching whitespace, stars, and quotes


RE_QUOTED

protected static Pattern RE_QUOTED
Pattern for matching anything inside quotes (inclusive)


RE_WILDCARD

protected static Pattern RE_WILDCARD
Wildcard Pattern


m_string

protected String m_string
Expression string.


m_patterns

protected List m_patterns
List<Pattern> of individual patterns

Constructor Detail

CollectionUtils.FilterExpression

public CollectionUtils.FilterExpression(String s)
Creates a new filter expression object from the specified string.

Method Detail

getExpressionString

public String getExpressionString()
Expression string. May be null or empty ("").


setExpressionString

public void setExpressionString(String s)
Expression string. May be null or empty ("").


matches

public boolean matches(String s)
True if the specified string matches this expression.


filter

public void filter(Collection collection,
                   CollectionUtils.IFilterableValueDecorator valueDecorator)
Removes the items from the specified collection whose value does not match the filter.

Parameters:
collection - Items to filter. The collection will be iterated, and the iterator's remove() method will be called for each item that does not match the filter.
valueDecorator - Decorator to use to calculate the value on which to filter for each item in the collection.