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 when creating an instance of an implementation fails.
029 *
030 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a>
031 * @version $Id: InstantiationException.java 8044 2009-07-02 01:29:05Z schulte2005 $
032 */
033 public class InstantiationException extends IllegalStateException
034 {
035 //--Constants---------------------------------------------------------------
036
037 /** Serial version UID for backwards compatibility with 1.0.x classes. */
038 private static final long serialVersionUID = -7299094102825525833L;
039
040 //---------------------------------------------------------------Constants--
041 //--Constructors------------------------------------------------------------
042
043 /**
044 * Creates a new {@code InstantiationException} instance.
045 *
046 * @param identifier the identifier of the implementation for which creating
047 * an instance failed.
048 * @param cause the cause of the exception.
049 */
050 public InstantiationException( final String identifier,
051 final Throwable cause )
052 {
053
054 super( InstantiationExceptionBundle.getInstance().
055 getInstantiationExceptionMessage( Locale.getDefault(),
056 identifier ) );
057
058 this.initCause( cause );
059 this.identifier = identifier;
060 }
061
062 //------------------------------------------------------------Constructors--
063 //--InstantiationException--------------------------------------------------
064
065 /**
066 * The identifier of the implementation for which creating an instance
067 * failed.
068 * @serial
069 */
070 private String identifier;
071
072 /**
073 * Gets the identifier of the implementation for which creating an instance
074 * failed.
075 *
076 * @return the identifier of the implementation for which creating an
077 * instance failed or {@code null}.
078 */
079 public String getIdentifier()
080 {
081 return this.identifier;
082 }
083
084 //--------------------------------------------------InstantiationException--
085 }