net.sourceforge.cobertura.instrument
Class ClassPattern

java.lang.Object
  extended by net.sourceforge.cobertura.instrument.ClassPattern

public class ClassPattern
extends java.lang.Object

This class represents a collection of regular expressions that will be used to see if a classname matches them. Regular expressions are specified by calling add methods. If no add methods are called, this class will match any classname.

Author:
John Lewis

Field Summary
private  java.util.Collection excludeClassesRegexes
           
private  java.util.Collection includeClassesRegexes
           
private static java.lang.String WEBINF_CLASSES
           
 
Constructor Summary
ClassPattern()
           
 
Method Summary
(package private)  void addExcludeClassesRegex(java.lang.String regex)
          Add a regex to the list of class regexes to exclude.
(package private)  void addIncludeClassesRegex(java.lang.String regex)
          Add a regex to the list of class regexes to include.
(package private)  boolean isSpecified()
          Returns true if any regular expressions have been specified by calling the add methods.
(package private)  boolean matches(java.lang.String filename)
          Check to see if a class matches this ClassPattern If a pattern has not been specified, this matches anything.
private  java.lang.String removeAnyWebInfClassesString(java.lang.String filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

includeClassesRegexes

private java.util.Collection includeClassesRegexes

excludeClassesRegexes

private java.util.Collection excludeClassesRegexes

WEBINF_CLASSES

private static final java.lang.String WEBINF_CLASSES
See Also:
Constant Field Values
Constructor Detail

ClassPattern

public ClassPattern()
Method Detail

isSpecified

boolean isSpecified()
Returns true if any regular expressions have been specified by calling the add methods. If none are specified, this class matches anything.

Returns:
true if any regular expressions have been specified

matches

boolean matches(java.lang.String filename)
Check to see if a class matches this ClassPattern If a pattern has not been specified, this matches anything. This method also looks for "WEB-INF/classes" at the beginning of the classname. It is removed before checking for a match.

Parameters:
filename - Either a full classname or a full class filename
Returns:
true if the classname matches this ClassPattern or if this ClassPattern has not been specified.

removeAnyWebInfClassesString

private java.lang.String removeAnyWebInfClassesString(java.lang.String filename)

addIncludeClassesRegex

void addIncludeClassesRegex(java.lang.String regex)
Add a regex to the list of class regexes to include.

Parameters:
regex - A regular expression to add.

addExcludeClassesRegex

void addExcludeClassesRegex(java.lang.String regex)
Add a regex to the list of class regexes to exclude.

Parameters:
regex -