View Javadoc

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