1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.expression.spel;
17
18 import org.springframework.expression.EvaluationException;
19
20
21
22
23
24
25
26
27
28 @SuppressWarnings("serial")
29 public class SpelEvaluationException extends EvaluationException {
30
31 private final SpelMessage message;
32
33 private final Object[] inserts;
34
35
36 public SpelEvaluationException(SpelMessage message, Object... inserts) {
37 super(message.formatMessage(0, inserts));
38 this.message = message;
39 this.inserts = inserts;
40 }
41
42 public SpelEvaluationException(int position, SpelMessage message, Object... inserts) {
43 super(position, message.formatMessage(position, inserts));
44 this.message = message;
45 this.inserts = inserts;
46 }
47
48 public SpelEvaluationException(int position, Throwable cause,
49 SpelMessage message, Object... inserts) {
50 super(position,message.formatMessage(position,inserts),cause);
51 this.message = message;
52 this.inserts = inserts;
53 }
54
55 public SpelEvaluationException(Throwable cause, SpelMessage message, Object... inserts) {
56 super(message.formatMessage(0,inserts),cause);
57 this.message = message;
58 this.inserts = inserts;
59 }
60
61
62
63
64
65 @Override
66 public String getMessage() {
67 if (this.message != null) {
68 return this.message.formatMessage(this.position, this.inserts);
69 }
70 else {
71 return super.getMessage();
72 }
73 }
74
75
76
77
78 public SpelMessage getMessageCode() {
79 return this.message;
80 }
81
82
83
84
85
86
87 public void setPosition(int position) {
88 this.position = position;
89 }
90
91
92
93
94 public Object[] getInserts() {
95 return this.inserts;
96 }
97
98 }