@Published(tag="architect") public class DiContainer extends java.lang.Object implements ObjectLoader
staticプロパティへのインジェクションは行われない。 インジェクションの対象となるプロパティがstaticである場合、例外が発生する。
後方互換性を維持するするため、システムプロパティ"nablarch.diContainer.allowStaticInjection"に
trueを設定することで、staticプロパティへのインジェクションを許可できる。
後方互換性維持以外の目的での使用は推奨しない。
| Constructor and Description |
|---|
DiContainer(ComponentDefinitionLoader loader)
コンストラクタ。
|
DiContainer(ComponentDefinitionLoader loader,
boolean allowStaticInjection)
コンストラクタ。
|
| Modifier and Type | Method and Description |
|---|---|
int |
generateId()
コンポーネントIDの最大値を取得する。
|
java.lang.Object |
getComponentById(int id)
コンポーネントIDをキーにコンポーネントを取得する。
|
<T> T |
getComponentByName(java.lang.String name)
コンポーネント名をキーにコンポーネントを取得する。
|
<T> T |
getComponentByType(java.lang.Class<T> type)
コンポーネントの型をキーにコンポーネントを取得する。
|
java.util.Map<java.lang.String,java.lang.Object> |
load()
DIしたオブジェクトを取得するロードメソッド。
|
protected ExternalizedComponentDefinitionLoader |
loadExternalizedComponentDefinitionLoader()
ExternalizedComponentDefinitionLoaderをServiceLoaderを使って読み込む。
ExternalizedComponentDefinitionLoaderのサービスプロバイダが設定されていない場合は、
後方互換を維持するためにSystemPropertyExternalizedLoaderが使用されます。 |
void |
reload()
コンテナの保持するオブジェクトの再生成を行う。
オブジェクトの再生成は下記順序で行う。 設定の読み込み コンポーネント定義の登録 コンポーネント定義にあるObjectLoaderの生成とObjectLoader内のコンポーネントのロード システムプロパティによるコンポーネント定義の上書き コンポーネントの生成 コンポーネントに対するインジェクションの実行 初期化対象クラスの初期化実行 |
public DiContainer(ComponentDefinitionLoader loader)
loader - コンポーネント定義のローダpublic DiContainer(ComponentDefinitionLoader loader, boolean allowStaticInjection)
loader - コンポーネント定義のローダallowStaticInjection - staticプロパティへのインジェクションを許容するかどうかprotected ExternalizedComponentDefinitionLoader loadExternalizedComponentDefinitionLoader()
ExternalizedComponentDefinitionLoaderをServiceLoaderを使って読み込む。
ExternalizedComponentDefinitionLoaderのサービスプロバイダが設定されていない場合は、
後方互換を維持するためにSystemPropertyExternalizedLoaderが使用されます。ExternalizedComponentDefinitionLoaderpublic java.util.Map<java.lang.String,java.lang.Object> load()
load in interface ObjectLoaderObjectLoader.load()public int generateId()
public void reload()
public java.lang.Object getComponentById(int id)
id - コンポーネントIDpublic <T> T getComponentByName(java.lang.String name)
T - コンポーネントの型name - コンポーネント名public <T> T getComponentByType(java.lang.Class<T> type)
T - コンポーネントの型type - コンポーネントの型