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 IllegalAttributeException 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 name;
36
37 /**
38 * {@link IllegalAttributeException} を作成します。
39 *
40 * @param targetClass
41 * 対象のクラス
42 * @param name
43 * 属性の名前
44 * @param cause
45 * 属性の操作に失敗した理由となる例外
46 */
47 public IllegalAttributeException(final Class<?> targetClass,
48 final String name, final Throwable cause) {
49 super(format("ECUB0051", targetClass.getName(), name, cause), cause);
50 this.targetClass = targetClass;
51 this.name = name;
52 }
53
54 /**
55 * 対象のクラスを返します。
56 *
57 * @return 対象のクラス
58 */
59 public Class<?> getTargetClass() {
60 return targetClass;
61 }
62
63 /**
64 * 属性名を返します。
65 *
66 * @return 属性名
67 */
68 public String getName() {
69 return name;
70 }
71 }