View Javadoc

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 inheritance constraint violations.
27   * <p>An {@code Implementation} is only allowed to be the parent of another
28   * implementation if the value of property {@code final} is {@code false}.
29   * This exception gets thrown for any implementation violating this
30   * constraint.</p>
31   *
32   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
33   * @version $JDTAUS: InheritanceConstraintException.java 8641 2012-09-27 06:45:17Z schulte $
34   *
35   * @see Implementation#getParent()
36   * @see Implementation#isFinal()
37   */
38  public class InheritanceConstraintException extends IllegalStateException
39  {
40      //--Constants---------------------------------------------------------------
41  
42      /** Serial version UID for backwards compatibility with 1.2.x classes. */
43      private static final long serialVersionUID = 8681879454481971406L;
44  
45      //---------------------------------------------------------------Constants--
46      //--Constructors------------------------------------------------------------
47  
48      /**
49       * Creates a new {@code InheritanceConstraintException} instance
50       * taking the identifier of the implementation violating the constraint.
51       *
52       * @param implementationIdentifier identifier of the implementation
53       * violating the constraint.
54       */
55      public InheritanceConstraintException(
56          final String implementationIdentifier )
57      {
58          super( InheritanceConstraintExceptionBundle.getInstance().
59                 getInheritanceConstraintMessage( Locale.getDefault(),
60                                                  implementationIdentifier ) );
61  
62          this.implementationIdentifier = implementationIdentifier;
63      }
64  
65      //------------------------------------------------------------Constructors--
66      //--InheritanceConstraintException------------------------------------------
67  
68      /**
69       * Identifier of the implementation violating the constraint.
70       * @serial
71       */
72      private final String implementationIdentifier;
73  
74      /**
75       * Gets the identifier of the implementation violating the constraint.
76       *
77       * @return identifier of the implementation violating the constraint.
78       */
79      public String getImplementationIdentifier()
80      {
81          return this.implementationIdentifier;
82      }
83  
84      //------------------------------------------InheritanceConstraintException--
85  }