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 * @since 2.0.0
25 */
26 public class IllegalPropertyException extends RuntimeException {
27
28 private static final long serialVersionUID = 1L;
29
30 private final Class<?> targetClass;
31
32 private final String propertyName;
33
34 /**
35 * {@link IllegalPropertyException}を作成します。
36 *
37 * @param targetClass
38 * @param propertyName
39 * @param cause
40 */
41 public IllegalPropertyException(final Class<?> targetClass,
42 final String propertyName, final Throwable cause) {
43 super(format("ECUB0051", targetClass.getName(), propertyName, cause),
44 cause);
45 this.targetClass = targetClass;
46 this.propertyName = propertyName;
47 }
48
49 /**
50 * ターゲットの{@link Class}を返します。
51 *
52 * @return ターゲットの{@link Class}
53 */
54 public Class<?> getTargetClass() {
55 return targetClass;
56 }
57
58 /**
59 * プロパティ名を返します。
60 *
61 * @return プロパティ名
62 */
63 public String getPropertyName() {
64 return propertyName;
65 }
66 }