Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.ucsb.ccs.jcontractor
Class PackageLevelInstrumentationFilter  view PackageLevelInstrumentationFilter download PackageLevelInstrumentationFilter.java

java.lang.Object
  extended byedu.ucsb.ccs.jcontractor.PackageLevelInstrumentationFilter
All Implemented Interfaces:
InstrumentationFilter

public class PackageLevelInstrumentationFilter
extends java.lang.Object
implements InstrumentationFilter

An instrumentation filter that assigns instrumentation level by package (or class, if desired). The filter is given a package name, a class name, and an instrumentation level. The class name may be "*" to match any class in the package or a subpackage. Note that this differs a little from how Java import statements work.

The filter level is how many levels down the package is, so "edu.*" has filter level 1, and "edu.ucsb.ccs.*" has filter level 3. This way, more specific filters override more general filters.

To match classes in the default package, but no other packages, use the "magic" package name "<default>".

Version:
$Id: PackageLevelInstrumentationFilter.java,v 1.2 2002/05/22 06:28:39 parkera Exp $

Field Summary
protected  java.lang.String classname
          The name of the class to match.
protected  int filterLevel
          The filter level of this filter, determined by how deep the package is.
protected  int instrumentationLevel
          The instrumentation level to assign to classes that match the class and package criteria.
protected  java.lang.String packagename
          The name of the package to match.
 
Fields inherited from interface edu.ucsb.ccs.jcontractor.InstrumentationFilter
ALL, NONE, POST, PRE
 
Constructor Summary
PackageLevelInstrumentationFilter(java.lang.String classAndPackageName, int instrumentationLevel)
          Create a filter from a class and package string.
PackageLevelInstrumentationFilter(java.lang.String packagename, java.lang.String classname, int instrumentationLevel)
          Create a new filter.
 
Method Summary
 boolean appliesTo(java.lang.String theclass)
          Determine if this filter applies to a given class.
protected  boolean getClassName_Postcondition(java.lang.String RESULT)
           
 java.lang.String getClassName()
          Get the name of the class matched by this filter.
protected  boolean getFilterLevel_Postcondition(int RESULT)
           
 int getFilterLevel()
          Get the level of this filter.
protected  boolean getInstrumentationLevel_Postcondition(int RESULT)
           
 int getInstrumentationLevel()
          Get the instrumentation level assigned to classes that match the filter criteria.
 int getInstrumentationLevel(java.lang.String theclass)
          Get the instrumentation level to assign to a class that matches the filter criteria.
protected  boolean getPackageName_Postcondition(java.lang.String RESULT)
           
 java.lang.String getPackageName()
          Get the name of the package matched by this filter.
protected  boolean setClassName_Precondition(java.lang.String name)
           
 void setClassName(java.lang.String name)
          Set the name of the class matched by this filter.
protected  boolean setInstrumentationLevel_Precondition(int level)
           
 void setInstrumentationLevel(int level)
          Set the instrumentation level assigned to classes that match the filter criteria.
 void setPackageAndClass(java.lang.String packageAndClass)
          Set the package and class from a full class name (including package).
protected  boolean setPackageName_Precondition(java.lang.String name)
           
 void setPackageName(java.lang.String name)
          Set the name of the package to match.
 java.lang.String toString()
          Get a string representation of the filter, for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

classname

protected java.lang.String classname
The name of the class to match. May be "*" to match any class in any subpackage.


packagename

protected java.lang.String packagename
The name of the package to match.


instrumentationLevel

protected int instrumentationLevel
The instrumentation level to assign to classes that match the class and package criteria.


filterLevel

protected int filterLevel
The filter level of this filter, determined by how deep the package is.

Constructor Detail

PackageLevelInstrumentationFilter

public PackageLevelInstrumentationFilter(java.lang.String packagename,
                                         java.lang.String classname,
                                         int instrumentationLevel)
Create a new filter.


PackageLevelInstrumentationFilter

public PackageLevelInstrumentationFilter(java.lang.String classAndPackageName,
                                         int instrumentationLevel)
Create a filter from a class and package string. To match all classes in any package, simply pass "*". If only a class name is given the default package is assumed ("jInstrument" is the same as "<default>.jInstrument").

Method Detail

appliesTo

public boolean appliesTo(java.lang.String theclass)
Determine if this filter applies to a given class. Returns true if the class matches the class and package criteria in this filter.

Specified by:
appliesTo in interface InstrumentationFilter

getInstrumentationLevel

public int getInstrumentationLevel(java.lang.String theclass)
Get the instrumentation level to assign to a class that matches the filter criteria.

Specified by:
getInstrumentationLevel in interface InstrumentationFilter

setPackageName

public void setPackageName(java.lang.String name)
Set the name of the package to match. If both class name and package name are "*", any class matches. If the class name is not "*", then a package name of "*" has no meaning (you can't match a certain class in any package).


setPackageName_Precondition

protected boolean setPackageName_Precondition(java.lang.String name)

getPackageName

public java.lang.String getPackageName()
Get the name of the package matched by this filter.


getPackageName_Postcondition

protected boolean getPackageName_Postcondition(java.lang.String RESULT)

setClassName

public void setClassName(java.lang.String name)
Set the name of the class matched by this filter. Pass "*" to match any class in any subpackage. If both class name and package name are "*", any class matches.


setClassName_Precondition

protected boolean setClassName_Precondition(java.lang.String name)

getClassName

public java.lang.String getClassName()
Get the name of the class matched by this filter.


getClassName_Postcondition

protected boolean getClassName_Postcondition(java.lang.String RESULT)

setPackageAndClass

public void setPackageAndClass(java.lang.String packageAndClass)
Set the package and class from a full class name (including package). Examples include "edu.ucsb.ccs.jcontractor.jInstrument" and "edu.ccs.*".


setInstrumentationLevel

public void setInstrumentationLevel(int level)
Set the instrumentation level assigned to classes that match the filter criteria.


setInstrumentationLevel_Precondition

protected boolean setInstrumentationLevel_Precondition(int level)

getInstrumentationLevel

public int getInstrumentationLevel()
Get the instrumentation level assigned to classes that match the filter criteria.


getInstrumentationLevel_Postcondition

protected boolean getInstrumentationLevel_Postcondition(int RESULT)

getFilterLevel

public int getFilterLevel()
Get the level of this filter. The filter level is determined by how the depth of the package. "*" has level 0, "edu.*" has level 1, "edu.ucsb.ccs.jcontractor.jInstrument" has level 4, etc.

Specified by:
getFilterLevel in interface InstrumentationFilter

getFilterLevel_Postcondition

protected boolean getFilterLevel_Postcondition(int RESULT)

toString

public java.lang.String toString()
Get a string representation of the filter, for debugging.