public class FunctionCriterion extends NegatableCriterion
An example of a function criterion is functionName(param1,param2)<0
.
Criterion.Operator
NEGATION
Constructor and Description |
---|
FunctionCriterion(String function,
String[] parameters,
String low,
String high,
boolean negation)
Instantiates a
FunctionCriterion for some function call
function(parameters). |
Modifier and Type | Method and Description |
---|---|
FunctionCriterion |
addParameter(String parameter)
Adds an extra function parameter to the end of the parameter list.
|
boolean |
equals(Object o) |
String |
getGreaterThan()
Returns the internal low value.
|
String |
getLessThan()
Returns the internal high value.
|
List |
getParameters()
Returns a reference to the internal list of function parameters.
|
int |
hashCode() |
boolean |
isEqual()
Tells whether this criterion is an equality test.
|
protected StringBuilder |
renderCall(StringBuilder builder)
Appends a string representation of the function call to the given
StringBuilder . |
FunctionCriterion |
setEqualTo(String value)
Sets this criterion to test for equality against the given value.
|
FunctionCriterion |
setGreaterThan(String lowParam)
Sets the lower bound of this criterion.
|
FunctionCriterion |
setLessThan(String highParam)
Sets the upper bound of this criterion.
|
void |
toLocation(StringBuilder builder)
Appends the string representation of this criterion to the given
StringBuilder . |
isNegate, isValidAttributeName, setNegate
getAttributeName, toLocation, toString
public FunctionCriterion(String function, String[] parameters, String low, String high, boolean negation)
FunctionCriterion
for some function call
function(parameters).
This criterion will select items for which execution of the specified function call yields a values that is bounded by the given lower and upper bound. These bounds are called the low and high, respectively. The lower bound is inclusive, the upper bound is exclusive. As a special exception, if low equals high then this criterion represents an equality test.
function
- The function that is to be called in order to evaluate this
criterion.parameters
- A (possibly empty) array of parameters that is to be supplied
to function as part of the function call.low
- The lower bound for this criterion; null
if no lower
bound.high
- The upper bound for this criterion; null
if no upper
bound.negation
- If true
this criterion will be configured to be a
negation.IllegalArgumentException
- If function is not a valid function name or both
low and high are null
.public void toLocation(StringBuilder builder)
StringBuilder
.
The general contract of this method is that if the StringBuilder
contains a valid location ending in a forward slash string prior
to invocation of this method, then its contents must also form a valid
location string upon completion of this method.
Important: this method will not itself insert a leading slash!
toLocation
in class Criterion
builder
- The StringBuilder
to which the string representation of
this criterion is to be appended.protected StringBuilder renderCall(StringBuilder builder)
StringBuilder
.
Important: the method will append the function call (i.e. the function name followed by comma-separated parameters, wrapped inside parenthesis) only.
builder
- The StringBuilder
to which the string representation of
the function call is to be appended.StringBuilder
reference that was passed in, i.e.
buffer.public FunctionCriterion addParameter(String parameter)
parameter
- A new additional parameter.MultiValuedCriterion
instance; useful for chained
manipulations.IllegalArgumentException
- If parameter is null
or empty.public List getParameters()
public FunctionCriterion setGreaterThan(String lowParam)
lowParam
- The lower bound for this criterion.MultiValuedCriterion
instance; useful for chained
manipulations.IllegalArgumentException
- If low is null
while the internal
high value is null
as well.public String getGreaterThan()
null
if no
lower bound is set.public FunctionCriterion setLessThan(String highParam)
highParam
- The upper bound for this criterion.FunctionCriterion
instance; useful for chained
manipulations.IllegalArgumentException
- If high is null
while the internal
low value is null
as well.public String getLessThan()
null
if no
upper bound is set.public FunctionCriterion setEqualTo(String value)
value
- The value to test against.SingleValuedCriterion
instance; useful for chained
manipulations.IllegalArgumentException
- If value is null
.public boolean isEqual()
true
if the internal low and high
values are equal; false
otherwise.public boolean equals(Object o)
equals
in class NegatableCriterion
public int hashCode()
hashCode
in class NegatableCriterion
Copyright © 2021 RWS Group for and on behalf of its affiliates and subsidiaries. All rights reserved.