KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > exception > MethodInvocationException


1 package org.apache.velocity.exception;
2
3 /*
4  * Copyright 2001,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 /**
20  * Application-level exception thrown when a reference method is
21  * invoked and an exception is thrown.
22  * <br>
23  * When this exception is thrown, a best effort will be made to have
24  * useful information in the exception's message. For complete
25  * information, consult the runtime log.
26  *
27  * @author <a HREF="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
28  * @version $Id: MethodInvocationException.java,v 1.2.14.1 2004/03/03 23:22:54 geirm Exp $
29  */

30 public class MethodInvocationException extends VelocityException
31 {
32     private String JavaDoc methodName = "";
33     private String JavaDoc referenceName = "";
34     private Throwable JavaDoc wrapped = null;
35
36     /**
37      * CTOR - wraps the passed in exception for
38      * examination later
39      *
40      * @param message
41      * @param e Throwable that we are wrapping
42      * @param methodName name of method that threw the exception
43      */

44     public MethodInvocationException( String JavaDoc message, Throwable JavaDoc e, String JavaDoc methodName )
45     {
46         super(message);
47         this.wrapped = e;
48         this.methodName = methodName;
49     }
50
51     /**
52      * Returns the name of the method that threw the
53      * exception
54      *
55      * @return String name of method
56      */

57     public String JavaDoc getMethodName()
58     {
59         return methodName;
60     }
61
62     /**
63      * returns the wrapped Throwable that caused this
64      * MethodInvocationException to be thrown
65      *
66      * @return Throwable thrown by method invocation
67      */

68     public Throwable JavaDoc getWrappedThrowable()
69     {
70         return wrapped;
71     }
72
73     /**
74      * Sets the reference name that threw this exception
75      *
76      * @param reference name of reference
77      */

78     public void setReferenceName( String JavaDoc ref )
79     {
80         referenceName = ref;
81     }
82
83     /**
84      * Retrieves the name of the reference that caused the
85      * exception
86      *
87      * @return name of reference
88      */

89     public String JavaDoc getReferenceName()
90     {
91         return referenceName;
92     }
93 }
94
Popular Tags