public class EqualsPredicate extends Predicate
EqualsPredicate
wraps EqualPredicate
to
provide additional functionality like serializing to and from a Map and JSON formatted data as well
as obtaining data using a ContextTransformer
Modifier and Type | Field and Description |
---|---|
static String |
NAME
The name of this
Predicate implementation |
Constructor and Description |
---|
EqualsPredicate(ContextTransformer transformer,
String value)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
boolean |
evaluate(Object o) |
boolean |
evaluateTransformedData(Object data)
Abstract method used internally to process the
evaluate(Object) logic after the
input data is transformed. |
static EqualsPredicate |
fromMap(Map<String,Object> map)
Creates a new
EqualsPredicate using the given Map of data. |
String |
getContextKey()
Gets the context key assigned to the
ContextTransformer . |
ContextTransformer |
getTransformer()
Gets the
Transformer |
String |
getValue()
Gets the test value
|
int |
hashCode() |
void |
setTransformer(ContextTransformer transformer)
Sets the
Transformer |
Map<String,Object> |
toMap()
|
public static final String NAME
Predicate
implementationpublic EqualsPredicate(ContextTransformer transformer, String value)
transformer
- the ContextTransformer
value
- the value to testpublic static EqualsPredicate fromMap(Map<String,Object> map)
EqualsPredicate
using the given Map
of data.
It is expected that the map contains a single Map.Entry
where the key name
is "equals" and the value is a Collection
of 2 String
s. The first value
should be the key to use when retrieving data from the context, which should resolve to a
String
(or null). The second value should be the value to use when checking for equality.
EqualsPredicate
public String getValue()
public boolean evaluateTransformedData(Object data)
evaluate(Object)
logic after the
input data is transformed.data
- the transformed data to usetrue
, false
)Predicate.evaluate(Object)
public ContextTransformer getTransformer()
Transformer
ContextTransformer
public void setTransformer(ContextTransformer transformer)
Transformer
transformer
- a ContextTransformer
public String getContextKey()
ContextTransformer
.
This key is used to identify which value from the context a passed to the
Predicate.evaluate(Object)
method
public boolean evaluate(Object o)
Copyright © 2022 Apache Software Foundation. All rights reserved.