1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.expression.spel.ast;
18
19 import org.springframework.expression.EvaluationException;
20 import org.springframework.expression.TypedValue;
21 import org.springframework.expression.spel.ExpressionState;
22
23
24
25
26
27
28
29
30
31
32 public class QualifiedIdentifier extends SpelNodeImpl {
33
34
35 private TypedValue value;
36
37
38 public QualifiedIdentifier(int pos, SpelNodeImpl... operands) {
39 super(pos, operands);
40 }
41
42
43 @Override
44 public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
45
46 if (this.value == null) {
47 StringBuilder sb = new StringBuilder();
48 for (int i = 0; i < getChildCount(); i++) {
49 Object value = this.children[i].getValueInternal(state).getValue();
50 if (i > 0 && !value.toString().startsWith("$")) {
51 sb.append(".");
52 }
53 sb.append(value);
54 }
55 this.value = new TypedValue(sb.toString());
56 }
57 return this.value;
58 }
59
60 @Override
61 public String toStringAST() {
62 StringBuilder sb = new StringBuilder();
63 if (this.value != null) {
64 sb.append(this.value.getValue());
65 }
66 else {
67 for (int i = 0; i < getChildCount(); i++) {
68 if (i > 0) {
69 sb.append(".");
70 }
71 sb.append(getChild(i).toStringAST());
72 }
73 }
74 return sb.toString();
75 }
76
77 }