1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.teeda.core.exception; |
17 | |
|
18 | |
import javax.faces.el.EvaluationException; |
19 | |
import javax.faces.el.MethodBinding; |
20 | |
|
21 | |
import org.seasar.framework.message.MessageFormatter; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public class ExtendEvaluationException extends EvaluationException { |
28 | |
|
29 | |
private static final long serialVersionUID = 3258407322669101874L; |
30 | |
|
31 | |
private static final String EVALUATION_EXCEPTION_ID = "ETDA0003"; |
32 | |
|
33 | |
private String messageCode_; |
34 | |
|
35 | |
private Object[] args_; |
36 | |
|
37 | |
private String simpleMessage_; |
38 | |
|
39 | |
private String message_; |
40 | |
|
41 | |
private MethodBinding methodBinding_; |
42 | |
|
43 | |
public ExtendEvaluationException(EvaluationException cause, MethodBinding mb) { |
44 | 1 | this(cause, mb.getClass().getName(), mb.getExpressionString()); |
45 | 1 | methodBinding_ = mb; |
46 | 1 | } |
47 | |
|
48 | |
public ExtendEvaluationException(Throwable cause, String className, |
49 | |
String expressionString) { |
50 | 2 | this(cause, className, expressionString, EVALUATION_EXCEPTION_ID); |
51 | 2 | } |
52 | |
|
53 | |
protected ExtendEvaluationException(Throwable cause, String className, |
54 | |
String expressionString, String messageCode) { |
55 | 2 | super(cause); |
56 | 2 | args_ = new Object[] { className, expressionString }; |
57 | 2 | messageCode_ = messageCode; |
58 | 2 | simpleMessage_ = MessageFormatter.getSimpleMessage(messageCode_, args_); |
59 | 2 | message_ = MessageFormatter.getFormattedMessage(messageCode_, |
60 | |
simpleMessage_); |
61 | |
|
62 | 2 | } |
63 | |
|
64 | |
public MethodBinding getMethodBinding() { |
65 | 1 | return methodBinding_; |
66 | |
} |
67 | |
|
68 | |
public final String getMessageCode() { |
69 | 2 | return messageCode_; |
70 | |
} |
71 | |
|
72 | |
public final Object[] getArgs() { |
73 | 1 | return args_; |
74 | |
} |
75 | |
|
76 | |
public final String getMessage() { |
77 | 2 | return message_; |
78 | |
} |
79 | |
|
80 | |
public final String getSimpleMessage() { |
81 | 0 | return simpleMessage_; |
82 | |
} |
83 | |
|
84 | |
} |