alt.jiapi
Class Rule

java.lang.Object
  extended by alt.jiapi.Rule
All Implemented Interfaces:
java.lang.Comparable

public class Rule
extends java.lang.Object
implements java.lang.Comparable

Implements a Rule in an InstrumentationDescriptor. Rules determine if a given class matches a certain InstrumentationDescriptor.

Rules can have wildcards.

Rules are ordered according to their precedence.

Version:
$Revision: 1.16 $ $Date: 2004/03/02 07:37:11 $
Author:
Mika Riekkinen, Joni Suominen

Constructor Summary
Rule(java.lang.String rule)
          Creates a rule used used by InstrumentationDescriptor to determine whether a particular class needs to be instrumented.
 
Method Summary
 int compareTo(java.lang.Object o)
          The precedence determines the order of Rules.
 boolean equals(java.lang.Object o)
          Two rules are equal if the strings which represent them equals.
 double getPrecedence()
          Get a precedence of this Rule.
 int hashCode()
           
 boolean isMoreSignificant(Rule other)
          Checks whether this Rule is more significant than the given Rule.
 boolean match(java.lang.String s)
          Check if a given String matches this Rule.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rule

public Rule(java.lang.String rule)
     throws JiapiException
Creates a rule used used by InstrumentationDescriptor to determine whether a particular class needs to be instrumented.

Parameters:
rule - a rule can be a classname and it can contain wildcards
Throws:
JiapiException
Method Detail

compareTo

public int compareTo(java.lang.Object o)
The precedence determines the order of Rules.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - other Rule

equals

public boolean equals(java.lang.Object o)
Two rules are equal if the strings which represent them equals. (e.g. "com.* == com.*", "com.foo.* != com.*")

Overrides:
equals in class java.lang.Object
Parameters:
o - other Rule

getPrecedence

public double getPrecedence()
Get a precedence of this Rule. Precedence determines the accuracy of a rule. The more significant rule wins over the less one. E.g. com.opensource.*.Foo is more significant than com.*.Foo since it more accurately describes the class.

Returns:
precedence

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isMoreSignificant

public boolean isMoreSignificant(Rule other)
Checks whether this Rule is more significant than the given Rule.

Parameters:
other - other Rule
Returns:
true if this Rule is more significant.

match

public boolean match(java.lang.String s)
Check if a given String matches this Rule.

Parameters:
s - String to match
Returns:
true on match, false on mismatch

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001. Documenation generated August 26 2011.