1 /*
2 * Copyright 2004-2009 the Seasar Foundation and the Others.
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,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.seasar.cubby.spi.beans;
17
18 import static org.seasar.cubby.internal.util.LogMessages.format;
19
20 /**
21 * 属性が見つからなかったことを表す例外です。
22 *
23 * @author baba
24 */
25 public class AttributeNotFoundException extends RuntimeException {
26
27 /** シリアルバージョン UID。 */
28 private static final long serialVersionUID = 1L;
29
30 /** 対象のクラス。 */
31 private final Class<?> targetClass;
32
33 /** プロパティ名。 */
34 private final String propertyName;
35
36 /**
37 * インスタンス化します。
38 *
39 * @param targetClass
40 * 対象のクラス
41 * @param propertyName
42 * プロパティ名
43 */
44 public AttributeNotFoundException(final Class<?> targetClass,
45 final String propertyName) {
46 super(format("ECUB0052", targetClass.getName(), propertyName));
47 this.targetClass = targetClass;
48 this.propertyName = propertyName;
49 }
50
51 /**
52 * 対象のクラスを返します。
53 *
54 * @return 対象のクラス
55 */
56 public Class<?> getTargetClass() {
57 return targetClass;
58 }
59
60 /**
61 * プロパティ名を返します。
62 *
63 * @return プロパティ名
64 */
65 public String getPropertyName() {
66 return propertyName;
67 }
68 }