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 inheritance constraint violations.
027 * <p>An {@code Implementation} is only allowed to be the parent of another
028 * implementation if the value of property {@code final} is {@code false}.
029 * This exception gets thrown for any implementation violating this
030 * constraint.</p>
031 *
032 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
033 * @version $JDTAUS: InheritanceConstraintException.java 8641 2012-09-27 06:45:17Z schulte $
034 *
035 * @see Implementation#getParent()
036 * @see Implementation#isFinal()
037 */
038public class InheritanceConstraintException extends IllegalStateException
039{
040    //--Constants---------------------------------------------------------------
041
042    /** Serial version UID for backwards compatibility with 1.2.x classes. */
043    private static final long serialVersionUID = 8681879454481971406L;
044
045    //---------------------------------------------------------------Constants--
046    //--Constructors------------------------------------------------------------
047
048    /**
049     * Creates a new {@code InheritanceConstraintException} instance
050     * taking the identifier of the implementation violating the constraint.
051     *
052     * @param implementationIdentifier identifier of the implementation
053     * violating the constraint.
054     */
055    public InheritanceConstraintException(
056        final String implementationIdentifier )
057    {
058        super( InheritanceConstraintExceptionBundle.getInstance().
059               getInheritanceConstraintMessage( Locale.getDefault(),
060                                                implementationIdentifier ) );
061
062        this.implementationIdentifier = implementationIdentifier;
063    }
064
065    //------------------------------------------------------------Constructors--
066    //--InheritanceConstraintException------------------------------------------
067
068    /**
069     * Identifier of the implementation violating the constraint.
070     * @serial
071     */
072    private final String implementationIdentifier;
073
074    /**
075     * Gets the identifier of the implementation violating the constraint.
076     *
077     * @return identifier of the implementation violating the constraint.
078     */
079    public String getImplementationIdentifier()
080    {
081        return this.implementationIdentifier;
082    }
083
084    //------------------------------------------InheritanceConstraintException--
085}