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