net.sf.jga.fn.property
public class CompareProperty<T,V> extends AbstractUnaryPredicate<T> implements Serializable
The test returns
bp(getProperty(name).fn(arg), value)
. This is also
equivalent to the following:
UnaryPredicate simpleCompare = new UnaryCompose(new Binder2nd(bp, value), new GetProperty(propName))with one less call to
fn
at evaluation and somewhat clearer
construction syntax.
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | CompareProperty.Visitor
Interface for classes that may interpret a CompareProperty
predicate. |
Constructor Summary | |
---|---|
CompareProperty(String propName, V val)
Builds the CompareProperty predicate that will compare the named
property to the given value using an EqualTo predicate. | |
CompareProperty(String propName, BinaryFunctor<V,V,Boolean> pred, V val)
Builds the CompareProperty predicate that will compare the named
property to the given value. |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(CompareProperty) method, if it
implements the nested Visitor interface. |
BinaryFunctor<V,V,Boolean> | getPredicate()
Returns the predicate used to compare property values |
String | getPropName()
Returns the name of the property to be compared |
V | getValue()
Returns the constant value to which properties are compared |
boolean | p(T arg)
Tests the designated property of the argument against the value given at
construction.
|
String | toString() |
visit(CompareProperty)
method, if it
implements the nested Visitor interface.Returns: the predicate used to compare property values.
Returns: the name of the property to be compared
Returns: the constant value to which properties are compared
Returns: the boolean value of the comparison
UNKNOWN: arg the object whose property will be tested