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