Class ExpressionEvalMap
An immutable AbstractMap
implementation that wraps a Map<String, Object>
,
where values must be instances of String
or Expression
,
and evaluates an expression
for the provided key
from the underlying
original
Map.
Any mutating operations (put(String, Object)
, remove(Object)
etc.)
are not allowed on instances of this class. Mutation can be performed on underlying Map
if it supports it.
A ExpressionEvalMap.ExpressionEvalMapBuilder
must be used to instantiate this class
via its from(Map)
method:
ExpressionEvalMap evalMap = ExpressionEvalMap
.from(expressions)
.usingCallback(new EvaluationCallback() {
Object evaluate(Expression expression) {
// return some expression evaluation
}
})
.build();
Thread-safety depends on the original underlying Map. Objects of this class are not serializable.
- Since:
- 3.0
- Author:
- Artem Bilan, Gary Russell
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
TheExpressionEvalMap.EvaluationCallback
implementation which evaluates an expression using the providedcontext
,root
andreturnType
variables.static interface
Implementations of this interface can be provided to build 'on demandget(Object)
logic' forExpressionEvalMap
.static final class
The builder class to instantiateExpressionEvalMap
.static interface
static interface
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) entrySet()
boolean
Gets thevalue
(Expression
) for the providedkey
fromoriginal
and returns the result of evaluation usingevaluationCallback
.int
hashCode()
boolean
isEmpty()
keySet()
void
int
size()
toString()
values()
Methods inherited from class java.util.AbstractMap
clone
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
SIMPLE_CALLBACK
-
-
Method Details
-
get
Gets thevalue
(Expression
) for the providedkey
fromoriginal
and returns the result of evaluation usingevaluationCallback
. -
entrySet
-
values
-
containsKey
- Specified by:
containsKey
in interfaceMap<String,
Object> - Overrides:
containsKey
in classAbstractMap<String,
Object>
-
keySet
-
isEmpty
public boolean isEmpty() -
size
public int size() -
equals
-
hashCode
public int hashCode() -
toString
- Overrides:
toString
in classAbstractMap<String,
Object>
-
put
-
putAll
-
clear
public void clear() -
containsValue
- Specified by:
containsValue
in interfaceMap<String,
Object> - Overrides:
containsValue
in classAbstractMap<String,
Object>
-
remove
-
from
-