Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » beans » [javadoc | source]
    1   /*
    2    * Copyright 2002-2008 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;
   18   
   19   import org.springframework.core.NestedRuntimeException;
   20   import org.springframework.util.ObjectUtils;
   21   
   22   /**
   23    * Abstract superclass for all exceptions thrown in the beans package
   24    * and subpackages.
   25    *
   26    * <p>Note that this is a runtime (unchecked) exception. Beans exceptions
   27    * are usually fatal; there is no reason for them to be checked.
   28    *
   29    * @author Rod Johnson
   30    * @author Juergen Hoeller
   31    */
   32   public abstract class BeansException extends NestedRuntimeException {
   33   
   34   	/**
   35   	 * Create a new BeansException with the specified message.
   36   	 * @param msg the detail message
   37   	 */
   38   	public BeansException(String msg) {
   39   		super(msg);
   40   	}
   41   
   42   	/**
   43   	 * Create a new BeansException with the specified message
   44   	 * and root cause.
   45   	 * @param msg the detail message
   46   	 * @param cause the root cause
   47   	 */
   48   	public BeansException(String msg, Throwable cause) {
   49   		super(msg, cause);
   50   	}
   51   
   52   
   53   	public boolean equals(Object other) {
   54   		if (this == other) {
   55   			return true;
   56   		}
   57   		if (!(other instanceof BeansException)) {
   58   			return false;
   59   		}
   60   		BeansException otherBe = (BeansException) other;
   61   		return (getMessage().equals(otherBe.getMessage()) &&
   62   				ObjectUtils.nullSafeEquals(getCause(), otherBe.getCause()));
   63   	}
   64   
   65   	public int hashCode() {
   66   		return getMessage().hashCode();
   67   	}
   68   
   69   }

Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » beans » [javadoc | source]