org.apache.cayenne.tools
Class NamePatternMatcher

java.lang.Object
  extended by org.apache.cayenne.tools.NamePatternMatcher

public class NamePatternMatcher
extends java.lang.Object

Provides name pattern matching functionality.

Since:
1.2
Author:
Andrei Adamchik, Mike Kienenberger

Field Summary
protected  java.util.regex.Pattern[] itemExcludeFilters
           
protected  java.util.regex.Pattern[] itemIncludeFilters
           
protected  org.apache.tools.ant.Task parentTask
           
 
Constructor Summary
NamePatternMatcher(org.apache.tools.ant.Task parentTask, java.lang.String includePattern, java.lang.String excludePattern)
           
 
Method Summary
 java.util.regex.Pattern[] createPatterns(java.lang.String patternString)
          Returns an array of Patterns.
protected  java.util.List filter(java.util.List items)
          Applies preconfigured list of filters to the list, removing entities that do not pass the filter.
protected  boolean passedExcludeFilter(CayenneMapEntry item)
          Returns true if the entity does not match any one of the "exclude" patterns, or if there is no "exclude" patterns defined.
protected  boolean passedIncludeFilter(CayenneMapEntry item)
          Returns true if the entity matches any one of the "include" patterns, or if there is no "include" patterns defined.
static java.lang.String replaceWildcardInStringWithString(java.lang.String wildcard, java.lang.String pattern, java.lang.String replacement)
           
 java.lang.String[] tokenizePattern(java.lang.String pattern)
          Returns an array of valid regular expressions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentTask

protected org.apache.tools.ant.Task parentTask

itemIncludeFilters

protected java.util.regex.Pattern[] itemIncludeFilters

itemExcludeFilters

protected java.util.regex.Pattern[] itemExcludeFilters
Constructor Detail

NamePatternMatcher

public NamePatternMatcher(org.apache.tools.ant.Task parentTask,
                          java.lang.String includePattern,
                          java.lang.String excludePattern)
Method Detail

createPatterns

public java.util.regex.Pattern[] createPatterns(java.lang.String patternString)
Returns an array of Patterns. Takes a comma-separated list of patterns, attempting to convert them to the java.util.regex.Pattern syntax. E.g.

"billing_*,user?" will become an array of two expressions:

^billing_.*$
^user.?$


tokenizePattern

public java.lang.String[] tokenizePattern(java.lang.String pattern)
Returns an array of valid regular expressions. Takes a comma-separated list of patterns, attempting to convert them to the java.util.regex.Pattern syntax. E.g.

"billing_*,user?" will become an array of two expressions:

^billing_.*$
^user.?$


filter

protected java.util.List filter(java.util.List items)
Applies preconfigured list of filters to the list, removing entities that do not pass the filter.


passedIncludeFilter

protected boolean passedIncludeFilter(CayenneMapEntry item)
Returns true if the entity matches any one of the "include" patterns, or if there is no "include" patterns defined.


passedExcludeFilter

protected boolean passedExcludeFilter(CayenneMapEntry item)
Returns true if the entity does not match any one of the "exclude" patterns, or if there is no "exclude" patterns defined.


replaceWildcardInStringWithString

public static java.lang.String replaceWildcardInStringWithString(java.lang.String wildcard,
                                                                 java.lang.String pattern,
                                                                 java.lang.String replacement)


Copyright © 2001-2006 Apache.org All Rights Reserved.