org.apache.cayenne.tools
Class NamePatternMatcher

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

public class NamePatternMatcher
extends Object

Provides name pattern matching functionality.

Since:
1.2

Field Summary
protected  Pattern[] itemExcludeFilters
           
protected  Pattern[] itemIncludeFilters
           
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
NamePatternMatcher(org.apache.commons.logging.Log logger, String includePattern, String excludePattern)
           
 
Method Summary
 Pattern[] createPatterns(String patternString)
          Returns an array of Patterns.
protected  List<?> filter(List<?> items)
          Deprecated. since 3.0
 boolean isIncluded(String string)
          Returns true if a given object property satisfies the include/exclude patterns.
protected  boolean passedExcludeFilter(CayenneMapEntry item)
          Deprecated. since 3.0
protected  boolean passedIncludeFilter(CayenneMapEntry item)
          Deprecated. since 3.0
static String replaceWildcardInStringWithString(String wildcard, String pattern, String replacement)
           
 String[] tokenizePattern(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

logger

protected org.apache.commons.logging.Log logger

itemIncludeFilters

protected Pattern[] itemIncludeFilters

itemExcludeFilters

protected Pattern[] itemExcludeFilters
Constructor Detail

NamePatternMatcher

public NamePatternMatcher(org.apache.commons.logging.Log logger,
                          String includePattern,
                          String excludePattern)
Method Detail

createPatterns

public Pattern[] createPatterns(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 String[] tokenizePattern(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.?$


isIncluded

public boolean isIncluded(String string)
Returns true if a given object property satisfies the include/exclude patterns.

Since:
3.0

filter

protected List<?> filter(List<?> items)
Deprecated. since 3.0

Applies preconfigured list of filters to the list, removing entities that do not pass the filter.


passedIncludeFilter

protected boolean passedIncludeFilter(CayenneMapEntry item)
Deprecated. since 3.0

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)
Deprecated. since 3.0

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 String replaceWildcardInStringWithString(String wildcard,
                                                       String pattern,
                                                       String replacement)


Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.