public final class ExpressionEvalMap
extends java.util.AbstractMap<java.lang.String,java.lang.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.
Modifier and Type | Class and Description |
---|---|
static class |
ExpressionEvalMap.ComponentsEvaluationCallback
The
ExpressionEvalMap.EvaluationCallback implementation which evaluates an expression using
the provided context , root and returnType variables. |
static interface |
ExpressionEvalMap.EvaluationCallback
Implementations of this interface can be provided to build 'on demand
get(Object) logic'
for ExpressionEvalMap . |
static class |
ExpressionEvalMap.ExpressionEvalMapBuilder
The builder class to instantiate
ExpressionEvalMap . |
static interface |
ExpressionEvalMap.ExpressionEvalMapComponentsBuilder |
static interface |
ExpressionEvalMap.ExpressionEvalMapFinalBuilder |
Modifier and Type | Field and Description |
---|---|
static ExpressionEvalMap.EvaluationCallback |
SIMPLE_CALLBACK |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
static ExpressionEvalMap.ExpressionEvalMapBuilder |
from(java.util.Map<java.lang.String,?> expressions) |
java.lang.Object |
get(java.lang.Object key)
Gets the
value (Expression ) for the provided key
from original and returns the result of evaluation using evaluationCallback . |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet() |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value) |
void |
putAll(java.util.Map<? extends java.lang.String,?> m) |
java.lang.Object |
remove(java.lang.Object key) |
int |
size() |
java.lang.String |
toString() |
java.util.Collection<java.lang.Object> |
values() |
public static final ExpressionEvalMap.EvaluationCallback SIMPLE_CALLBACK
public java.lang.Object get(java.lang.Object key)
value
(Expression
) for the provided key
from original
and returns the result of evaluation using evaluationCallback
.get
in interface java.util.Map<java.lang.String,java.lang.Object>
get
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.util.Collection<java.lang.Object> values()
values
in interface java.util.Map<java.lang.String,java.lang.Object>
values
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.lang.Object>
containsKey
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.lang.Object>
keySet
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.lang.Object>
isEmpty
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public int size()
size
in interface java.util.Map<java.lang.String,java.lang.Object>
size
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map<java.lang.String,java.lang.Object>
equals
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public int hashCode()
hashCode
in interface java.util.Map<java.lang.String,java.lang.Object>
hashCode
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.lang.Object>
entrySet
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in interface java.util.Map<java.lang.String,java.lang.Object>
put
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public void putAll(java.util.Map<? extends java.lang.String,?> m)
putAll
in interface java.util.Map<java.lang.String,java.lang.Object>
putAll
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public void clear()
clear
in interface java.util.Map<java.lang.String,java.lang.Object>
clear
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,java.lang.Object>
containsValue
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.lang.Object>
remove
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public java.lang.String toString()
toString
in class java.util.AbstractMap<java.lang.String,java.lang.Object>
public static ExpressionEvalMap.ExpressionEvalMapBuilder from(java.util.Map<java.lang.String,?> expressions)