| 1 | /* |
| 2 | * jDTAUS Core API |
| 3 | * Copyright (C) 2005 Christian Schulte |
| 4 | * <cs@schulte.it> |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | * |
| 20 | */ |
| 21 | package org.jdtaus.core.container; |
| 22 | |
| 23 | import java.util.Locale; |
| 24 | |
| 25 | /** |
| 26 | * Gets thrown for multiplicity constraint violations. |
| 27 | * <p>Specifications with a multiplicity of {@code MULTIPLICITY_ONE} specify |
| 28 | * that exactly one corresponding implementation must be available among a set |
| 29 | * of modules. This exception gets thrown for any specification violating this |
| 30 | * constraint.</p> |
| 31 | * |
| 32 | * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> |
| 33 | * @version $JDTAUS: MultiplicityConstraintException.java 8641 2012-09-27 06:45:17Z schulte $ |
| 34 | * |
| 35 | * @see Specification#getMultiplicity() |
| 36 | */ |
| 37 | public class MultiplicityConstraintException extends IllegalStateException |
| 38 | { |
| 39 | //--Constants--------------------------------------------------------------- |
| 40 | |
| 41 | /** Serial version UID for backwards compatibility with 1.2.x classes. */ |
| 42 | private static final long serialVersionUID = 344879434134284092L; |
| 43 | |
| 44 | //---------------------------------------------------------------Constants-- |
| 45 | //--Constructors------------------------------------------------------------ |
| 46 | |
| 47 | /** |
| 48 | * Creates a new {@code MultiplicityConstraintException} taking the |
| 49 | * identifier of the specification for which the multiplicity constraint |
| 50 | * is violated. |
| 51 | * |
| 52 | * @param specificationIdentifier identifier of the specification for |
| 53 | * which the constraint is violated. |
| 54 | */ |
| 55 | public MultiplicityConstraintException( final String specificationIdentifier ) |
| 56 | { |
| 57 | super( MultiplicityConstraintExceptionBundle.getInstance(). |
| 58 | getMultiplicityConstraintMessage( Locale.getDefault(), |
| 59 | specificationIdentifier ) ); |
| 60 | |
| 61 | this.specificationIdentifier = specificationIdentifier; |
| 62 | } |
| 63 | |
| 64 | //------------------------------------------------------------Constructors-- |
| 65 | //--MultiplicityConstraintException----------------------------------------- |
| 66 | |
| 67 | /** |
| 68 | * Identifier of the specification for which the multiplicity constraint |
| 69 | * is violated. |
| 70 | * @serial |
| 71 | */ |
| 72 | private final String specificationIdentifier; |
| 73 | |
| 74 | /** |
| 75 | * Gets the identifier of the specification for which the multiplicity |
| 76 | * constraint is violated. |
| 77 | * |
| 78 | * @return the identifier of the specification for which the multiplicity |
| 79 | * constraint is violated. |
| 80 | */ |
| 81 | public String getSpecificationIdentifier() |
| 82 | { |
| 83 | return this.specificationIdentifier; |
| 84 | } |
| 85 | |
| 86 | //-----------------------------------------MultiplicityConstraintException-- |
| 87 | } |