01: /*
02: * Copyright 2004-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.compass.core.accessor;
18:
19: import org.compass.core.CompassException;
20: import org.compass.core.util.StringUtils;
21:
22: /**
23: * @author kimchy
24: */
25: public class PropertyAccessException extends CompassException {
26:
27: private static final long serialVersionUID = 3257002142513772083L;
28:
29: private final Class persistentClass;
30:
31: private final String propertyName;
32:
33: private final boolean wasSetter;
34:
35: public PropertyAccessException(Throwable root, String s,
36: boolean wasSetter, Class persistentClass,
37: String propertyName) {
38: super (s, root);
39: this .persistentClass = persistentClass;
40: this .wasSetter = wasSetter;
41: this .propertyName = propertyName;
42: }
43:
44: public Class getPersistentClass() {
45: return persistentClass;
46: }
47:
48: public String getPropertyName() {
49: return propertyName;
50: }
51:
52: public String getMessage() {
53: return super .getMessage()
54: + (wasSetter ? " setter of " : " getter of ")
55: + StringUtils.qualify(persistentClass.getName(),
56: propertyName);
57: }
58: }
|