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 dependencies.
029     *
030     * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a>
031     * @version $Id: IllegalDependencyTypeException.java 8044 2009-07-02 01:29:05Z schulte2005 $
032     */
033    public class IllegalDependencyTypeException extends IllegalStateException
034    {
035        //--Constants---------------------------------------------------------------
036    
037        /** Serial version UID for backwards compatibility with 1.5.x classes. */
038        private static final long serialVersionUID = 1616079465342123026L;
039    
040        //---------------------------------------------------------------Constants--
041        //--Constructors------------------------------------------------------------
042    
043        /**
044         * Creates a new instance of {@code IllegalDependencyTypeException} taking
045         * information about the dependency with illegal type.
046         *
047         * @param implementationIdentifier the identifier of the implementation with
048         * a dependency of illegal type.
049         * @param name the name of the dependency with illegal type.
050         * @param type the illegal type of the dependency with name {@code name}.
051         * @param expectedType the expected type of the dependency with name
052         * {@code name}.
053         */
054        public IllegalDependencyTypeException( final String implementationIdentifier,
055                                               final String name, final String type,
056                                               final String expectedType )
057        {
058            super( IllegalDependencyTypeExceptionBundle.getInstance().
059                   getIllegalDependencyTypeMessage( Locale.getDefault(),
060                                                    implementationIdentifier, name,
061                                                    type, expectedType ) );
062    
063            this.implementationIdentifier = implementationIdentifier;
064            this.name = name;
065            this.type = type;
066            this.expectedType = expectedType;
067        }
068    
069        //------------------------------------------------------------Constructors--
070        //--IllegalDependencyTypeException------------------------------------------
071    
072        /**
073         * The identifier of the implementation with a dependency of illegal type.
074         * @serial
075         */
076        private String implementationIdentifier;
077    
078        /**
079         * The name of the dependency with illegal type.
080         * @serial
081         */
082        private String name;
083    
084        /**
085         * The illegal type.
086         * @serial
087         */
088        private String type;
089    
090        /**
091         * The expected type.
092         * @serial
093         */
094        private String expectedType;
095    
096        /**
097         * Gets the identifier of the implementation with a dependency of illegal
098         * type.
099         *
100         * @return the identifier of the implementation with a dependency of illegal
101         * type.
102         */
103        public String getImplementationIdentifier()
104        {
105            return this.implementationIdentifier;
106        }
107    
108        /**
109         * Gets the name of the dependency with illegal type.
110         *
111         * @return the name of the dependency with illegal type.
112         */
113        public String getName()
114        {
115            return this.name;
116        }
117    
118        /**
119         * Gets the illegal type of the dependency.
120         *
121         * @return the illegal type of the dependency.
122         */
123        public String getType()
124        {
125            return this.type;
126        }
127    
128        /**
129         * Gets the expected type of the dependency.
130         *
131         * @return the expected type of the dependency.
132         */
133        public String getExpectedType()
134        {
135            return this.expectedType;
136        }
137    
138        //------------------------------------------IllegalDependencyTypeException--
139    }