public class Criterion extends Object implements Serializable
When data is dragged over a drop target, the value here is compared to the payload added in DropTargetExtension with same key and value type.
| Modifier and Type | Class and Description |
|---|---|
static class |
Criterion.Match
Declares whether all or any of the given criteria should match when
compared against the payload.
|
| Constructor and Description |
|---|
Criterion(String key,
ComparisonOperator operator,
double value)
Creates a criterion object.
|
Criterion(String key,
ComparisonOperator operator,
int value)
Creates a criterion object.
|
Criterion(String key,
String value)
Creates a criterion object with the default comparison operator
ComparisonOperator.EQUALS. |
| Modifier and Type | Method and Description |
|---|---|
String |
getKey()
Gets the key of the payload to be compared.
|
ComparisonOperator |
getOperator()
Gets the comparison operator.
|
String |
getValue()
Gets the value of the payload to be compared.
|
Payload.ValueType |
getValueType()
Gets the type of the payload value to be compared.
|
boolean |
resolve(Collection<Payload> payloadCollection)
Compares this criterion's value to the given payload's value and returns
whether the result matches the criterion's operator.
|
void |
setKey(String key)
Sets the key of the payload to be compared.
|
void |
setOperator(ComparisonOperator operator)
Sets the comparison operator.
|
void |
setValue(String value)
Sets the value of the payload to be compared.
|
void |
setValueType(Payload.ValueType valueType)
Sets the type of the payload value to be compared.
|
public Criterion(String key, String value)
ComparisonOperator.EQUALS.key - key of the payload to be comparedvalue - value of the payload to be comparedpublic Criterion(String key, ComparisonOperator operator, int value)
key - key of the payload to be comparedoperator - comparison operatorvalue - value of the payload to be comparedpublic Criterion(String key, ComparisonOperator operator, double value)
key - key of the payload to be comparedoperator - comparison operatorvalue - value of the payload to be comparedpublic String getKey()
public void setKey(String key)
key - key of the payload to be comparedpublic String getValue()
public void setValue(String value)
value - value of the payload to be comparedpublic Payload.ValueType getValueType()
public void setValueType(Payload.ValueType valueType)
valueType - type of the payload to be comparedpublic ComparisonOperator getOperator()
public void setOperator(ComparisonOperator operator)
operator - comparison operatorpublic boolean resolve(Collection<Payload> payloadCollection)
payloadCollection - collection of payloads to compare the criterion againstfalse if there exists a payload in the collection with
the same key and value type and it doesn't match the criterion,
true otherwiseCopyright © 2021 Vaadin Ltd. All rights reserved.