1 /*
2 * jDTAUS Core API
3 * Copyright (C) 2005 Christian Schulte
4 * <cs@schulte.it>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21 package org.jdtaus.core.container;
22
23 import java.util.Locale;
24
25 /**
26 * Gets thrown for type collisions of inherited properties, implemented
27 * properties, or dependency properties.
28 *
29 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
30 * @version $JDTAUS: IllegalPropertyTypeException.java 8743 2012-10-07 03:06:20Z schulte $
31 */
32 public class IllegalPropertyTypeException extends IllegalStateException
33 {
34 //--Constants---------------------------------------------------------------
35
36 /** Serial version UID for backwards compatibility with 1.5.x classes. */
37 private static final long serialVersionUID = -2081711860347150219L;
38
39 //---------------------------------------------------------------Constants--
40 //--Constructors------------------------------------------------------------
41
42 /**
43 * Creates a new instance of {@code IllegalPropertyTypeException} taking a
44 * property name and the illegal type.
45 *
46 * @param name the name of the property with illegal type.
47 * @param type the illegal type of the property with name {@code name}.
48 * @param expectedType the expected type of the property with name
49 * {@code name}.
50 */
51 public IllegalPropertyTypeException( final String name, final Class type,
52 final Class expectedType )
53 {
54 super( IllegalPropertyTypeExceptionBundle.getInstance().
55 getIllegalPropertyTypeMessage( Locale.getDefault(), name,
56 type.getName(),
57 expectedType.getName() ) );
58
59 this.name = name;
60 this.type = type;
61 this.expectedType = expectedType;
62 }
63
64 //------------------------------------------------------------Constructors--
65 //--IllegalPropertyTypeException--------------------------------------------
66
67 /**
68 * The name of the property with illegal type.
69 * @serial
70 */
71 private final String name;
72
73 /**
74 * The illegal type.
75 * @serial
76 */
77 private final Class type;
78
79 /**
80 * The expected type.
81 * @serial
82 */
83 private final Class expectedType;
84
85 /**
86 * Gets the name of the property with illegal type.
87 *
88 * @return the name of the property with illegal type.
89 */
90 public String getName()
91 {
92 return this.name;
93 }
94
95 /**
96 * Gets the illegal type of the property.
97 *
98 * @return the illegal type of the property.
99 */
100 public Class getType()
101 {
102 return this.type;
103 }
104
105 /**
106 * Gets the expected type of the property.
107 *
108 * @return the expected type of the property.
109 */
110 public Class getExpectedType()
111 {
112 return this.expectedType;
113 }
114
115 //--------------------------------------------IllegalPropertyTypeException--
116 }