001 /*
002 * jDTAUS Core API
003 * Copyright (c) 2005 Christian Schulte
004 *
005 * Christian Schulte, Haldener Strasse 72, 58095 Hagen, Germany
006 * <schulte2005@users.sourceforge.net> (+49 2331 3543887)
007 *
008 * This library is free software; you can redistribute it and/or
009 * modify it under the terms of the GNU Lesser General Public
010 * License as published by the Free Software Foundation; either
011 * version 2.1 of the License, or any later version.
012 *
013 * This library is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016 * Lesser General Public License for more details.
017 *
018 * You should have received a copy of the GNU Lesser General Public
019 * License along with this library; if not, write to the Free Software
020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
021 *
022 */
023 package org.jdtaus.core.container;
024
025 import java.util.Locale;
026
027 /**
028 * Gets thrown for type collisions of inherited properties, implemented
029 * properties, or dependency properties.
030 *
031 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a>
032 * @version $Id: IllegalPropertyTypeException.java 8044 2009-07-02 01:29:05Z schulte2005 $
033 */
034 public class IllegalPropertyTypeException extends IllegalStateException
035 {
036 //--Constants---------------------------------------------------------------
037
038 /** Serial version UID for backwards compatibility with 1.5.x classes. */
039 private static final long serialVersionUID = -2081711860347150219L;
040
041 //---------------------------------------------------------------Constants--
042 //--Constructors------------------------------------------------------------
043
044 /**
045 * Creates a new instance of {@code IllegalPropertyTypeException} taking a
046 * property name and the illegal type.
047 *
048 * @param name the name of the property with illegal type.
049 * @param type the illegal type of the property with name {@code name}.
050 * @param expectedType the expected type of the property with name
051 * {@code name}.
052 */
053 public IllegalPropertyTypeException( final String name, final Class type,
054 final Class expectedType )
055 {
056 super( IllegalPropertyTypeExceptionBundle.getInstance().
057 getIllegalPropertyTypeMessage( Locale.getDefault(), name,
058 type.getName(),
059 expectedType.getName() ) );
060
061 this.name = name;
062 this.type = type;
063 this.expectedType = expectedType;
064 }
065
066 //------------------------------------------------------------Constructors--
067 //--IllegalPropertyTypeException--------------------------------------------
068
069 /**
070 * The name of the property with illegal type.
071 * @serial
072 */
073 private String name;
074
075 /**
076 * The illegal type.
077 * @serial
078 */
079 private Class type;
080
081 /**
082 * The expected type.
083 * @serial
084 */
085 private Class expectedType;
086
087 /**
088 * Gets the name of the property with illegal type.
089 *
090 * @return the name of the property with illegal type.
091 */
092 public String getName()
093 {
094 return this.name;
095 }
096
097 /**
098 * Gets the illegal type of the property.
099 *
100 * @return the illegal type of the property.
101 */
102 public Class getType()
103 {
104 return this.type;
105 }
106
107 /**
108 * Gets the expected type of the property.
109 *
110 * @return the expected type of the property.
111 */
112 public Class getExpectedType()
113 {
114 return this.expectedType;
115 }
116
117 //--------------------------------------------IllegalPropertyTypeException--
118 }