org.openadaptor.adaptor.value.predicate
Class DoublePredicate
java.lang.Object
org.openadaptor.adaptor.value.predicate.AbstractComparisonPredicate
org.openadaptor.adaptor.value.predicate.DoublePredicate
- All Implemented Interfaces:
- XFPredicate
public class DoublePredicate
- extends AbstractComparisonPredicate
Compares a Double value in the named attribute against either another
attribute in the same DataObject, or a literal double value.
Supported Properties are:
PredPrefix.Name = Integer
PredPrefix.AttName = attr-name // double-value attribute being tested.
PredPrefix.Operator = comparison operator ==, !=, <=, >=, <, >.
PredPrefix.Value = {12.0} // literal value in braces
| attr-name // another attribute in the object.
Note that the attributes used need not be of type double; they are converted
into strings then into doubles, so ints, longs, BigDecimals, strings
containing numbers will work, but be careful of the possibility of rounding
errors.
Note also that because of rounding errors, == and != are not always
accurate; it is best to arrange your tests to use 'greater than' and
'less than' if possible.
Field Summary |
(package private) static org.apache.log4j.Logger |
log
|
Fields inherited from class org.openadaptor.adaptor.value.predicate.AbstractComparisonPredicate |
ATTNAME_PROP, attrName, comparisonString, EQ, GE, GT, LE, LT, NE, operator, OPERATOR_PROP, predicateName, VALUE_PROP |
Method Summary |
protected void |
setValue(java.lang.String c)
|
protected boolean |
test(java.lang.String atValue,
DataObject dataObj)
Override this method to check a specific attribute value
Note the value to be tested has been converted from its native form into
a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
static org.apache.log4j.Logger log
DoublePredicate
public DoublePredicate()
setValue
protected void setValue(java.lang.String c)
throws ValueException
- Specified by:
setValue
in class AbstractComparisonPredicate
- Throws:
ValueException
test
protected boolean test(java.lang.String atValue,
DataObject dataObj)
throws ValueException
- Description copied from class:
AbstractComparisonPredicate
- Override this method to check a specific attribute value
Note the value to be tested has been converted from its native form into
a String.
- Specified by:
test
in class AbstractComparisonPredicate
- Parameters:
atValue
- Attribute value as a String.dataObj
-
- Returns:
- True if comparison value maps to a valid integer, and comparison
is correct.
- Throws:
ValueException