com.googlecode.lightest.core.filter
Class ComparisonFilter

java.lang.Object
  extended by com.googlecode.lightest.core.filter.ComparisonFilter
All Implemented Interfaces:
ITestFilter, groovy.lang.GroovyObject
Direct Known Subclasses:
AnnotationFilter

public abstract class ComparisonFilter
extends Object
implements groovy.lang.GroovyObject, ITestFilter

Filters an attribute related to the test method based on a value and an operation with that value. The case sensitivity of the filtering can be set. Filtering is case-sensitive by default.


Constructor Summary
ComparisonFilter()
           
 
Method Summary
abstract  boolean compare(Object value, Object attributeValue)
          Returns true if the comparison criteria is satisfied, false otherwise.
abstract  Object getAttributeValue(Object field, Method m)
          Returns the method attribute identified by the given field.
 Object getField()
           
 groovy.lang.MetaClass getMetaClass()
           
 Object getProperty(String name)
           
 Object getValue()
           
 Object invokeMethod(String name, Object args)
           
 boolean isCaseSensitive()
           
 void setCaseSensitive(boolean caseSensitive)
          Sets whether the comparison should be case sensitive for Strings.
 void setField(Object value)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(String name, Object value)
           
 void setValue(Object value)
           
 boolean test(Method m)
          Compares the test method's attribute value as obtained by getAttributeValue() with the defined value, using compare() for the compare operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.googlecode.lightest.core.filter.ITestFilter
filterString
 

Constructor Detail

ComparisonFilter

public ComparisonFilter()
Method Detail

getField

public Object getField()

setField

public void setField(Object value)

getValue

public Object getValue()

setValue

public void setValue(Object value)

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Sets whether the comparison should be case sensitive for Strings. Has no effect if the values being compared are not Strings.

Parameters:
caseSensitive - case-sensitive if true, not if false

isCaseSensitive

public boolean isCaseSensitive()

test

public boolean test(Method m)
Compares the test method's attribute value as obtained by getAttributeValue() with the defined value, using compare() for the compare operation. Case-sensitivity is determined by whether/how setCaseSensitive() was invoked, and has no effect when the values being compared are not Strings!

Specified by:
test in interface ITestFilter
Parameters:
m -

compare

public abstract boolean compare(Object value,
                                Object attributeValue)
Returns true if the comparison criteria is satisfied, false otherwise.

Parameters:
value - the value to compare against
attributeValue - the value being compared

getAttributeValue

public abstract Object getAttributeValue(Object field,
                                         Method m)
Returns the method attribute identified by the given field. This should be a modifiable value.

Parameters:
field - the field to get
m - the method for which to retrive the attribute value

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject

invokeMethod

public Object invokeMethod(String name,
                           Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface groovy.lang.GroovyObject

setProperty

public void setProperty(String name,
                        Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject


Copyright © 2009. All Rights Reserved.