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 multiplicity constraint violations.
029     * <p>Specifications with a multiplicity of {@code MULTIPLICITY_ONE} specify
030     * that exactly one corresponding implementation must be available among a set
031     * of modules. This exception gets thrown for any specification violating this
032     * constraint.</p>
033     *
034     * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a>
035     * @version $Id: MultiplicityConstraintException.java 8044 2009-07-02 01:29:05Z schulte2005 $
036     *
037     * @see Specification#getMultiplicity()
038     */
039    public class MultiplicityConstraintException extends IllegalStateException
040    {
041        //--Constants---------------------------------------------------------------
042    
043        /** Serial version UID for backwards compatibility with 1.2.x classes. */
044        private static final long serialVersionUID = 344879434134284092L;
045    
046        //---------------------------------------------------------------Constants--
047        //--Constructors------------------------------------------------------------
048    
049        /**
050         * Creates a new {@code MultiplicityConstraintException} taking the
051         * identifier of the specification for which the multiplicity constraint
052         * is violated.
053         *
054         * @param specificationIdentifier identifier of the specification for
055         * which the constraint is violated.
056         */
057        public MultiplicityConstraintException( final String specificationIdentifier )
058        {
059            super( MultiplicityConstraintExceptionBundle.getInstance().
060                   getMultiplicityConstraintMessage( Locale.getDefault(),
061                                                     specificationIdentifier ) );
062    
063            this.specificationIdentifier = specificationIdentifier;
064        }
065    
066        //------------------------------------------------------------Constructors--
067        //--MultiplicityConstraintException-----------------------------------------
068    
069        /**
070         * Identifier of the specification for which the multiplicity constraint
071         * is violated.
072         * @serial
073         */
074        private final String specificationIdentifier;
075    
076        /**
077         * Gets the identifier of the specification for which the multiplicity
078         * constraint is violated.
079         *
080         * @return the identifier of the specification for which the multiplicity
081         * constraint is violated.
082         */
083        public String getSpecificationIdentifier()
084        {
085            return this.specificationIdentifier;
086        }
087    
088        //-----------------------------------------MultiplicityConstraintException--
089    }