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
Nested ClassesModifier and TypeClassDescriptionstatic classTheExpressionEvalMap.EvaluationCallbackimplementation which evaluates an expression using the providedcontext,rootandreturnTypevariables.static interfaceImplementations of this interface can be provided to build 'on demandget(Object)logic' forExpressionEvalMap.static final classThe builder class to instantiateExpressionEvalMap.static interfacestatic interfaceNested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanGets thevalue(Expression) for the providedkeyfromoriginaland returns the result of evaluation usingevaluationCallback.inthashCode()booleanisEmpty()keySet()voidintsize()toString()values()Methods inherited from class java.util.AbstractMap
cloneMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
SIMPLE_CALLBACK
-
-
Method Details
-
get
-
entrySet
-
values
-
containsKey
- Specified by:
containsKeyin interfaceMap<String,Object> - Overrides:
containsKeyin classAbstractMap<String,Object>
-
keySet
-
isEmpty
-
size
-
equals
-
hashCode
-
toString
- Overrides:
toStringin classAbstractMap<String,Object>
-
put
-
putAll
-
clear
-
containsValue
- Specified by:
containsValuein interfaceMap<String,Object> - Overrides:
containsValuein classAbstractMap<String,Object>
-
remove
-
from
-