KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > TypeMismatchException


1 /*****************************************************************************
2  * Copyright (C) Codehaus.org. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Mar 6, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan;
15
16 /**
17  * Represents any type mismatch exception.
18  * <p>
19  * Codehaus.org.
20  *
21  * @author Ben Yu
22  *
23  */

24 public class TypeMismatchException extends YanException {
25   private final Class JavaDoc expected_type;
26   private final Class JavaDoc actual_type;
27   
28   /**
29    * Create a TypeMismatchException object.
30    * @param expected_type the expected type.
31    * @param actual_type the actual type.
32    */

33   public TypeMismatchException(
34       final Class JavaDoc expected_type, final Class JavaDoc actual_type) {
35     super("type mismatch");
36     this.expected_type = expected_type;
37     this.actual_type = actual_type;
38   }
39   /**
40    * Create a TypeMismatchException object.
41    * @param expected_type the expected type.
42    * @param actual_type the actual type.
43    * @param msg the error message.
44    */

45   public TypeMismatchException(
46       final Class JavaDoc expected_type, final Class JavaDoc actual_type,
47       final String JavaDoc msg) {
48     super(msg);
49     this.expected_type = expected_type;
50     this.actual_type = actual_type;
51   }
52   /**
53    * Get the actual argument type.
54    * @return the actual argument type.
55    */

56   public Class JavaDoc getActualType() {
57     return actual_type;
58   }
59   /**
60    * Get the expected type.
61    * @return the expected type.
62    */

63   public Class JavaDoc getExpectedType() {
64     return expected_type;
65   }
66 }
67
Popular Tags