-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathEagerAstIdentifier.java
More file actions
50 lines (42 loc) · 1.16 KB
/
EagerAstIdentifier.java
File metadata and controls
50 lines (42 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.hubspot.jinjava.el.ext.eager;
import com.hubspot.jinjava.el.ext.DeferredParsingException;
import de.odysseus.el.tree.Bindings;
import de.odysseus.el.tree.impl.ast.AstIdentifier;
import jakarta.el.ELContext;
public class EagerAstIdentifier extends AstIdentifier implements EvalResultHolder {
protected Object evalResult;
protected boolean hasEvalResult;
public EagerAstIdentifier(String name, int index, boolean ignoreReturnType) {
super(name, index, ignoreReturnType);
}
@Override
public Object eval(Bindings bindings, ELContext context) {
return EvalResultHolder.super.eval(
() -> super.eval(bindings, context),
bindings,
context
);
}
@Override
public Object getEvalResult() {
return evalResult;
}
@Override
public void setEvalResult(Object evalResult) {
this.evalResult = evalResult;
hasEvalResult = true;
}
@Override
public boolean hasEvalResult() {
return hasEvalResult;
}
@Override
public String getPartiallyResolved(
Bindings bindings,
ELContext context,
DeferredParsingException deferredParsingException,
boolean preserveIdentifier
) {
return getName();
}
}