Home » Spring-Framework-090522 » org.springframework » beans » factory » [javadoc | source]

    1   /*
    2    * Copyright 2002-2007 the original author or authors.
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
   10    * Unless required by applicable law or agreed to in writing, software
   11    * distributed under the License is distributed on an "AS IS" BASIS,
   12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13    * See the License for the specific language governing permissions and
   14    * limitations under the License.
   15    */
   16   
   17   package org.springframework.beans.factory;
   18   
   19   import org.springframework.beans.FatalBeanException;
   20   
   21   /**
   22    * Exception thrown when a BeanFactory encounters an invalid bean definition:
   23    * e.g. in case of incomplete or contradictory bean metadata.
   24    *
   25    * @author Rod Johnson
   26    * @author Juergen Hoeller
   27    * @author Rob Harrop
   28    */
   29   public class BeanDefinitionStoreException extends FatalBeanException {
   30   
   31   	private String resourceDescription;
   32   
   33   	private String beanName;
   34   
   35   
   36   	/**
   37   	 * Create a new BeanDefinitionStoreException.
   38   	 * @param msg the detail message (used as exception message as-is)
   39   	 */
   40   	public BeanDefinitionStoreException(String msg) {
   41   		super(msg);
   42   	}
   43   
   44   	/**
   45   	 * Create a new BeanDefinitionStoreException.
   46   	 * @param msg the detail message (used as exception message as-is)
   47   	 * @param cause the root cause (may be <code>null</code>)
   48   	 */
   49   	public BeanDefinitionStoreException(String msg, Throwable cause) {
   50   		super(msg, cause);
   51   	}
   52   
   53   	/**
   54   	 * Create a new BeanDefinitionStoreException.
   55   	 * @param resourceDescription description of the resource that the bean definition came from
   56   	 * @param msg the detail message (used as exception message as-is)
   57   	 */
   58   	public BeanDefinitionStoreException(String resourceDescription, String msg) {
   59   		super(msg);
   60   		this.resourceDescription = resourceDescription;
   61   	}
   62   
   63   	/**
   64   	 * Create a new BeanDefinitionStoreException.
   65   	 * @param resourceDescription description of the resource that the bean definition came from
   66   	 * @param msg the detail message (used as exception message as-is)
   67   	 * @param cause the root cause (may be <code>null</code>)
   68   	 */
   69   	public BeanDefinitionStoreException(String resourceDescription, String msg, Throwable cause) {
   70   		super(msg, cause);
   71   		this.resourceDescription = resourceDescription;
   72   	}
   73   
   74   	/**
   75   	 * Create a new BeanDefinitionStoreException.
   76   	 * @param resourceDescription description of the resource that the bean definition came from
   77   	 * @param beanName the name of the bean requested
   78   	 * @param msg the detail message (appended to an introductory message that indicates
   79   	 * the resource and the name of the bean)
   80   	 */
   81   	public BeanDefinitionStoreException(String resourceDescription, String beanName, String msg) {
   82   		this(resourceDescription, beanName, msg, null);
   83   	}
   84   
   85   	/**
   86   	 * Create a new BeanDefinitionStoreException.
   87   	 * @param resourceDescription description of the resource that the bean definition came from
   88   	 * @param beanName the name of the bean requested
   89   	 * @param msg the detail message (appended to an introductory message that indicates
   90   	 * the resource and the name of the bean)
   91   	 * @param cause the root cause (may be <code>null</code>)
   92   	 */
   93   	public BeanDefinitionStoreException(String resourceDescription, String beanName, String msg, Throwable cause) {
   94   		super("Invalid bean definition with name '" + beanName + "' defined in " + resourceDescription + ": " + msg, cause);
   95   		this.resourceDescription = resourceDescription;
   96   		this.beanName = beanName;
   97   	}
   98   
   99   
  100   	/**
  101   	 * Return the description of the resource that the bean
  102   	 * definition came from, if any.
  103   	 */
  104   	public String getResourceDescription() {
  105   		return this.resourceDescription;
  106   	}
  107   
  108   	/**
  109   	 * Return the name of the bean requested, if any.
  110   	 */
  111   	public String getBeanName() {
  112   		return this.beanName;
  113   	}
  114   
  115   }

Home » Spring-Framework-090522 » org.springframework » beans » factory » [javadoc | source]