01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: /**
20: * Exception thrown when referring to an invalid bean property.
21: * Carries the offending bean class and property name.
22: *
23: * @author Juergen Hoeller
24: * @since 1.0.2
25: */
26: public class InvalidPropertyException extends FatalBeanException {
27:
28: private Class beanClass;
29:
30: private String propertyName;
31:
32: /**
33: * Create a new InvalidPropertyException.
34: * @param beanClass the offending bean class
35: * @param propertyName the offending property
36: * @param msg the detail message
37: */
38: public InvalidPropertyException(Class beanClass,
39: String propertyName, String msg) {
40: this (beanClass, propertyName, msg, null);
41: }
42:
43: /**
44: * Create a new InvalidPropertyException.
45: * @param beanClass the offending bean class
46: * @param propertyName the offending property
47: * @param msg the detail message
48: * @param cause the root cause
49: */
50: public InvalidPropertyException(Class beanClass,
51: String propertyName, String msg, Throwable cause) {
52: super ("Invalid property '" + propertyName + "' of bean class ["
53: + beanClass.getName() + "]: " + msg, cause);
54: this .beanClass = beanClass;
55: this .propertyName = propertyName;
56: }
57:
58: /**
59: * Return the offending bean class.
60: */
61: public Class getBeanClass() {
62: return beanClass;
63: }
64:
65: /**
66: * Return the name of the offending property.
67: */
68: public String getPropertyName() {
69: return propertyName;
70: }
71:
72: }
|