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