/* * Copyright 2004-2006 the Seasar Foundation and the Others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ package org.seasar.framework.container; import org.seasar.framework.exception.SRuntimeException; /** * コンポーネントのインスタンスを、 {@link ComponentDef コンポーネント定義}のクラスにキャスト出来ない場合にスローされます。 *
* {@link Expression コンポーネント生成式}でインスタンスの生成を定義している場合は、 * そのインスタンスをコンポーネント定義のクラスにキャスト出来ないことを表します。 *
** {@link ComponentDef コンポーネント定義}を指定して、 * 外部コンポーネントにS2コンテナ上のコンポーネントをインジェクションする場合は、 その外部コンポーネントを、 * インジェクションの際に指定したコンポーネント定義のクラスにキャスト出来ないことを表します。 *
* * @author higa * @author belltree (Javadoc) * * @see org.seasar.framework.container.ConstructorAssembler#assemble() * @see org.seasar.framework.container.S2Container#injectDependency(Object, * Class) * @see org.seasar.framework.container.S2Container#injectDependency(Object, * String) */ public class ClassUnmatchRuntimeException extends SRuntimeException { private static final long serialVersionUID = 1967770604202235241L; private Class componentClass_; private Class realComponentClass_; /** *ClassUnmatchRuntimeException
を構築します。
*
* @param componentClass
* コンポーネント定義のクラス
* @param realComponentClass
* 実際のコンポーネントインスタンスのクラス
*/
public ClassUnmatchRuntimeException(Class componentClass,
Class realComponentClass) {
super("ESSR0069", new Object[] {
componentClass.getName(),
realComponentClass != null ? realComponentClass.getName()
: "null" });
componentClass_ = componentClass;
realComponentClass_ = realComponentClass;
}
/**
* コンポーネントの定義上のクラスを返します。
*
* @return コンポーネント定義のクラス
*/
public Class getComponentClass() {
return componentClass_;
}
/**
* {@link AspectDef アスペクト}が適用されたコンポーネントインスタンスのクラスを返します。
*
* @return 実際のコンポーネントインスタンスのクラス
*/
public Class getRealComponentClass() {
return realComponentClass_;
}
}