org.tromer.jie
Class WildcardGenericStaticFilter

java.lang.Object
  |
  +--org.tromer.jie.WildcardGenericStaticFilter

class WildcardGenericStaticFilter
extends java.lang.Object
implements GenericStaticFilter

A generic static filter implementation that uses wildcards. See stringMatchesPattern() below for details.


Field Summary
 java.lang.String classNamePattern
           
 java.lang.String methodNamePattern
           
 java.lang.String packageNamePattern
           
 
Constructor Summary
(package private) WildcardGenericStaticFilter()
           
 
Method Summary
 boolean isClassAccepted(VisitContext context)
           
 boolean isMethodAccepted(VisitContext context)
           
 boolean isPackageAccepted(VisitContext context)
           
static java.lang.String joinPatterns(java.lang.String first, java.lang.String second)
          Joins two patterns, creating an OR.
protected static boolean stringMatchesPattern(java.lang.String str, java.lang.String pattern)
          Returns true if the string matches the pattern.
protected static boolean stringMatchesSimplePattern(java.lang.String name, java.lang.String pattern)
          Returns true if the string matches the simple pattern.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packageNamePattern

public java.lang.String packageNamePattern

classNamePattern

public java.lang.String classNamePattern

methodNamePattern

public java.lang.String methodNamePattern
Constructor Detail

WildcardGenericStaticFilter

WildcardGenericStaticFilter()
Method Detail

isPackageAccepted

public boolean isPackageAccepted(VisitContext context)
Specified by:
isPackageAccepted in interface GenericStaticFilter

isClassAccepted

public boolean isClassAccepted(VisitContext context)
Specified by:
isClassAccepted in interface GenericStaticFilter

isMethodAccepted

public boolean isMethodAccepted(VisitContext context)
Specified by:
isMethodAccepted in interface GenericStaticFilter

joinPatterns

public static java.lang.String joinPatterns(java.lang.String first,
                                            java.lang.String second)
Joins two patterns, creating an OR.

stringMatchesPattern

protected static boolean stringMatchesPattern(java.lang.String str,
                                              java.lang.String pattern)
Returns true if the string matches the pattern. The pattern semantics are optimized for Java identifiers, and work as follows:

A pattern contains zero or more simple patterns separated by "|". The string matches the patten it matches at least one of the simple patterns, or if the pattern is empty or null.

A simple pattern may contain at most one "*" wildcard, which matches any string. If a simple pattern is of the form "*.xxx", then as a special case it also matches "xxx" (useful for the unnamed package). If it of the form "xxx.*", then as a special case it also matches "xxx" (useful for filtering by method or class name regardless of package).

Leading and trailing spaces are ignored.


stringMatchesSimplePattern

protected static boolean stringMatchesSimplePattern(java.lang.String name,
                                                    java.lang.String pattern)
Returns true if the string matches the simple pattern. See stringMatchesPattern for the definition of a simple pattern.