KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > InvalidPropertyException


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 7, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan;
15
16 import jfun.util.Misc;
17
18 /**
19  * Represents any exception about a component property.
20  * <p>
21  * Codehaus.org.
22  *
23  * @author Ben Yu
24  *
25  */

26 public class InvalidPropertyException extends YanException {
27   private final Class JavaDoc type;
28   private final String JavaDoc name;
29
30   /**
31    * Create an InvalidPropertyException object.
32    * @param type the component type.
33    * @param name the property name.
34    * @param msg the error message.
35    */

36   public InvalidPropertyException(Class JavaDoc type, String JavaDoc name, String JavaDoc msg) {
37     super(msg);
38     this.type = type;
39     this.name = name;
40   }
41
42
43   /**
44    * Create an InvalidPropertyException object.
45    * @param type the component type.
46    * @param name the property name.
47    */

48   public InvalidPropertyException(Class JavaDoc type, String JavaDoc name) {
49     super("invalid property: " + name + " in type "
50         +Misc.getTypeName(type));
51     this.type = type;
52     this.name = name;
53   }
54
55   /**
56    * Get the component type.
57    * @return the component type.
58    */

59   public Class JavaDoc getComponentType() {
60     return type;
61   }
62   /**
63    * Get the property name.
64    * @return the property name.
65    */

66   public String JavaDoc getPropertyName() {
67     return name;
68   }
69 }
70
Popular Tags