Coverage Report - org.seasar.teeda.core.exception.ExtendEvaluationException
 
Classes in this File Line Coverage Branch Coverage Complexity
ExtendEvaluationException
94%
15/16
N/A
1
 
 1  
 /*
 2  
  * Copyright 2004-2011 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.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  
  * @author shot
 25  
  * @author manhole
 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  
 }