View Javadoc

1   /*
2    * Copyright 2004-2006 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.tuigwaa.system;
17  
18  import org.seasar.framework.message.MessageFormatter;
19  
20  /***
21   * @author someda
22   */
23  public class TgwException extends Exception {
24  
25  	private static final long serialVersionUID = -1058116385857827825L;
26  	
27      private String messageCode;
28  
29      private Object[] args;
30  
31      private String message;
32  
33      private String simpleMessage;
34      
35      public TgwException(String messageCode){
36      	this(messageCode,null,null);
37      }
38      
39      public TgwException(String messageCode, Object[] args){
40      	this(messageCode,args,null);
41      }
42      
43      public TgwException(String messageCode, Object[] args, Throwable cause){
44      	super(cause);    	
45          this.messageCode = messageCode;
46          this.args = args;
47          simpleMessage = MessageFormatter.getSimpleMessage(messageCode, args);
48          message = "[" + messageCode + "]" + simpleMessage;    	
49      }
50      
51      public final String getMessageCode() {
52          return messageCode;
53      }
54  
55      public final Object[] getArgs() {
56          return args;
57      }
58  
59      public final String getMessage() {
60          return message;
61      }
62  
63      protected void setMessage(String message) {
64          this.message = message;
65      }
66  
67      public final String getSimpleMessage() {
68          return simpleMessage;
69      }	
70  
71  }