Class ExpressionEvalMap
public final class ExpressionEvalMap extends AbstractMap<String,Object>
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 Classes Modifier and Type Class Description static classExpressionEvalMap.ComponentsEvaluationCallbackTheExpressionEvalMap.EvaluationCallbackimplementation which evaluates an expression using the providedcontext,rootandreturnTypevariables.static interfaceExpressionEvalMap.EvaluationCallbackImplementations of this interface can be provided to build 'on demandget(Object)logic' forExpressionEvalMap.static classExpressionEvalMap.ExpressionEvalMapBuilderThe builder class to instantiateExpressionEvalMap.static interfaceExpressionEvalMap.ExpressionEvalMapComponentsBuilderstatic interfaceExpressionEvalMap.ExpressionEvalMapFinalBuilderNested 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
Fields Modifier and Type Field Description static ExpressionEvalMap.EvaluationCallbackSIMPLE_CALLBACK -
Method Summary
Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<String,Object>>entrySet()booleanequals(Object o)static ExpressionEvalMap.ExpressionEvalMapBuilderfrom(Map<String,?> expressions)Objectget(Object key)Gets thevalue(Expression) for the providedkeyfromoriginaland returns the result of evaluation usingevaluationCallback.inthashCode()booleanisEmpty()Set<String>keySet()Objectput(String key, Object value)voidputAll(Map<? extends String,?> m)Objectremove(Object key)intsize()StringtoString()Collection<Object>values()Methods 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
-
Method Details
-
get
Gets thevalue(Expression) for the providedkeyfromoriginaland returns the result of evaluation usingevaluationCallback. -
entrySet
-
values
-
containsKey
- Specified by:
containsKeyin interfaceMap<String,Object>- Overrides:
containsKeyin classAbstractMap<String,Object>
-
keySet
-
isEmpty
public boolean isEmpty() -
size
public int size() -
equals
-
hashCode
public int hashCode() -
toString
- Overrides:
toStringin classAbstractMap<String,Object>
-
put
-
putAll
-
clear
public void clear() -
containsValue
- Specified by:
containsValuein interfaceMap<String,Object>- Overrides:
containsValuein classAbstractMap<String,Object>
-
remove
-
from
-