インターフェース BeanManager
- すべてのスーパーインターフェース:
BeanContainer
public interface BeanManager extends BeanContainer
ポータブル拡張機能がコンテナーと直接やり取りできるようにします。Bean のコンテキスト参照を取得するための操作と、ポータブル拡張機能を使用するための他の多くの操作を提供します。
CDI Lite 環境では、アプリケーションは
BeanManagerを取得できますが、BeanContainerから継承されていないメソッドを呼び出すと、移植性のない動作が発生します。Bean は、次のように挿入することで
BeanManagerのインスタンスを取得できます。@Inject BeanManager manager;
Java EE コンポーネントは、
java:comp/BeanManagerという名前を検索することによって、JNDISE からBeanManagerのインスタンスを取得できます。BeanManager のほとんどの操作は、アプリケーションの実行中にいつでも呼び出すことができます。
ただし、
AfterBeanDiscoveryイベントが発生する前に、次の操作を呼び出さないでください。BeanContainer.getBeans(String),BeanContainer.getBeans(java.lang.reflect.Type, java.lang.annotation.Annotation...),getPassivationCapableBean(String),BeanContainer.resolve(java.util.Set),resolveDecorators(java.util.Set, java.lang.annotation.Annotation...),BeanContainer.resolveInterceptors(InterceptionType, java.lang.annotation.Annotation...),resolveObserverMethods(Object, java.lang.annotation.Annotation...),validate(InjectionPoint),BeanContainer.createInstance()
AfterDeploymentValidationイベントが発生する前に、次の操作を呼び出さないでください。BeanContainer.getReference(Bean, java.lang.reflect.Type, CreationalContext),getInjectableReference(InjectionPoint, CreationalContext),
コンテナーが例外をスローします。
- 作成者:
- Gavin King, Pete Muir, Clint Popetz, David Allen, Antoine Sabot-Durand
方法の概要
すべてのメソッド インスタンスメソッド 抽象メソッド 修飾子と型 メソッド 説明 booleanareInterceptorBindingsEquivalent(AnnotationSE interceptorBinding1, AnnotationSE interceptorBinding2)Nonbindingでアノテーションが付けられたメンバーを考慮して、2 つのインターセプターバインディングが型安全な解決の目的で同等と見なされるかどうかを判断します。booleanareQualifiersEquivalent(AnnotationSE qualifier1, AnnotationSE qualifier2)Nonbindingでアノテーションが付けられたメンバーを考慮して、2 つの修飾子が型安全な解決の目的で同等と見なされるかどうかを判断します。<T> AnnotatedType<T>createAnnotatedType(ClassSE<T> type)指定されたクラスまたはインターフェースのアノテーションを読み取るために使用できるAnnotatedTypeを取得します。<T> Bean<T>createBean(BeanAttributes<T> attributes, ClassSE<T> beanClass, InjectionTargetFactory<T> injectionTargetFactory)<T,X>
Bean<T>createBean(BeanAttributes<T> attributes, ClassSE<X> beanClass, ProducerFactory<X> producerFactory)BeanAttributes<?>createBeanAttributes(AnnotatedMember<?> type)指定されたAnnotatedTypeのBeanAttributesを取得します。<T> BeanAttributes<T>createBeanAttributes(AnnotatedType<T> type)指定されたAnnotatedTypeのBeanAttributesを取得します。InjectionPointcreateInjectionPoint(AnnotatedField<?> field)指定されたAnnotatedFieldのInjectionPointのコンテナー提供の実装を取得します。InjectionPointcreateInjectionPoint(AnnotatedParameter<?> parameter)指定されたAnnotatedParameterのInjectionPointのコンテナー提供の実装を取得します。<T> InterceptionFactory<T>createInterceptionFactory(CreationalContext<T> ctx, ClassSE<T> clazz)指定されたCreationalContextと型のInterceptionFactoryを作成します。ELResolvergetELResolver()EL 名で Bean を解決するELResolverを返します。<T extends Extension>
TgetExtension(ClassSE<T> extensionClass)META-INF/servicesで宣言された Extension クラスのコンテナーのインスタンスを取得します。ObjectSEgetInjectableReference(InjectionPoint ij, CreationalContext<?> ctx)特定のインジェクションポイントの注入可能な参照を取得します。<T> InjectionTargetFactory<T>getInjectionTargetFactory(AnnotatedType<T> annotatedType)コンテナーが作成したInjectionTargetインスタンスを提供するInjectionTargetFactoryの実装。SetSE<AnnotationSE>getInterceptorBindingDefinition(ClassSE<? extends AnnotationSE> bindingType)特定のインターセプターバインディング型のメタアノテーションのセットを取得します。intgetInterceptorBindingHashCode(AnnotationSE interceptorBinding)JDK アルゴリズムを使用してアノテーションハッシュコードを決定し、Nonbindingでアノテーションされたメンバーを無視して、インターセプターバインディングのハッシュコードを決定します。Bean<?>getPassivationCapableBean(StringSE id)指定された識別子を持つPassivationCapableBean を返します。<X> ProducerFactory<X>getProducerFactory(AnnotatedField<? super X> field, Bean<X> declaringBean)指定されたフィールドに対してコンテナーが作成したProducerインスタンスを提供するProducerFactoryの実装。<X> ProducerFactory<X>getProducerFactory(AnnotatedMethod<? super X> method, Bean<X> declaringBean)指定されたメソッドに対してコンテナーが作成したProducerインスタンスを提供するProducerFactoryの実装。intgetQualifierHashCode(AnnotationSE qualifier)アノテーションハッシュコードを決定するための JDK アルゴリズムを使用して、Nonbindingでアノテーションされたメンバーを無視して、修飾子のハッシュコードを決定します。SetSE<AnnotationSE>getStereotypeDefinition(ClassSE<? extends AnnotationSE> stereotype)特定のステレオタイプのメタアノテーションを取得します。booleanisPassivatingScope(ClassSE<? extends AnnotationSE> annotationType)指定されたアノテーション型をテストして、それが非活性化スコープ型であるかどうかを判断します。ListSE<Decorator<?>>resolveDecorators(SetSE<TypeSE> types, AnnotationSE... qualifiers)Return an ordered list of decorators for a set of bean types and a set of qualifiers and which are enabled in the module or library containing the class into which theBeanManagerwas injected or the Java EE component from whose JNDI environment namespace theBeanManagerwas obtained.<T> SetSE<ObserverMethod<? super T>>resolveObserverMethods(T event, AnnotationSE... qualifiers)イベントのオブザーバーメソッドの順序付けられたセットを返します。voidvalidate(InjectionPoint injectionPoint)特定のインジェクションポイントを検証します。ExpressionFactorywrapExpressionFactory(ExpressionFactory expressionFactory)インターフェース jakarta.enterprise.inject.spi.BeanContainer から継承されたメソッド
createCreationalContext, createInstance, getBeans, getBeans, getContext, getEvent, getReference, isInterceptorBinding, isNormalScope, isQualifier, isScope, isStereotype, resolve, resolveInterceptors
メソッドの詳細
getPassivationCapableBean
Bean<?> getPassivationCapableBean(StringSE id)
指定された識別子を持つPassivationCapableBean を返します。AfterBeanDiscoveryイベントオブザーバーの呼び出し中に呼び出された場合、このメソッドは、AfterBeanDiscoveryイベントが発生する前にコンテナーによって検出された Bean のみを返すことに注意してください。- パラメーター:
id- 識別子- 戻り値:
PassivationCapableを実装し、指定された識別子を持つBean、そのような Bean がない場合は null 値- 例外:
IllegalStateExceptionSE- アプリケーションの初期化中に呼び出された場合、AfterBeanDiscoveryイベントが発生する前。
validate
void validate(InjectionPoint injectionPoint)
特定のインジェクションポイントを検証します。AfterBeanDiscoveryイベントオブザーバーの呼び出し中に呼び出された場合、このメソッドは、AfterBeanDiscoveryイベントが発生する前にコンテナーによって検出されたインジェクションポイントのみを検証することに注意してください。- パラメーター:
injectionPoint- 検証するインジェクションポイント- 例外:
InjectionException- インジェクションポイントに関連付けられているデプロイ問題(たとえば、満たされていない、解決できないあいまいな依存関係)がある場合IllegalStateExceptionSE- アプリケーションの初期化中に呼び出された場合、AfterBeanDiscoveryイベントが発生する前。
resolveObserverMethods
<T> SetSE<ObserverMethod<? super T>> resolveObserverMethods(T event, AnnotationSE... qualifiers)
イベントのオブザーバーメソッドの順序付けられたセットを返します。AfterBeanDiscoveryイベントオブザーバーの呼び出し中に呼び出された場合、このメソッドは、AfterBeanDiscoveryイベントが発生する前にコンテナーによって検出されたオブザーバーのみを返すことに注意してください。- 次で指定:
- インターフェース
BeanContainer内のresolveObserverMethods - 型パラメーター:
T- イベントの型- パラメーター:
event- イベントオブジェクトqualifiers- イベント修飾子- 戻り値:
- 結果として得られるオブザーバーメソッドのセット
- 例外:
IllegalArgumentExceptionSE- イベントオブジェクトの実行時型に型変数が含まれる場合IllegalArgumentExceptionSE- 同じ非反復修飾子型の 2 つのインスタンスが指定されている場合IllegalArgumentExceptionSE- 修飾子型ではないアノテーションのインスタンスが指定された場合IllegalStateExceptionSE- アプリケーションの初期化中に呼び出された場合、AfterBeanDiscoveryイベントが発生する前。
resolveDecorators
ListSE<Decorator<?>> resolveDecorators(SetSE<TypeSE> types, AnnotationSE... qualifiers)
Return an ordered list of decorators for a set of bean types and a set of qualifiers and which are enabled in the module or library containing the class into which theBeanManagerwas injected or the Java EE component from whose JNDI environment namespace theBeanManagerwas obtained. Note that when called during invocation of anAfterBeanDiscoveryevent observer, this method will only return decorators discovered by the container before theAfterBeanDiscoveryevent is fired.- パラメーター:
types- 装飾された Bean の Bean 型のセットqualifiers- 装飾された Bean によって宣言された修飾子- 戻り値:
- 結果として得られるデコレータのセット
- 例外:
IllegalArgumentExceptionSE- Bean 型のセットが空の場合IllegalArgumentExceptionSE- バインディング型ではないアノテーションが渡された場合IllegalArgumentExceptionSE- 同じバインディング型の 2 つのインスタンスが渡された場合IllegalStateExceptionSE- アプリケーションの初期化中に呼び出された場合、AfterBeanDiscoveryイベントが発生する前。
isPassivatingScope
boolean isPassivatingScope(ClassSE<? extends AnnotationSE> annotationType)
指定されたアノテーション型をテストして、それが非活性化スコープ型であるかどうかを判断します。- パラメーター:
annotationType- アノテーション型- 戻り値:
- アノテーション型が不動態化スコープ型の場合は
true
getInterceptorBindingDefinition
SetSE<AnnotationSE> getInterceptorBindingDefinition(ClassSE<? extends AnnotationSE> bindingType)
特定のインターセプターバインディング型のメタアノテーションのセットを取得します。- パラメーター:
bindingType- インターセプターバインディング型- 戻り値:
- メタアノテーションのセット
getStereotypeDefinition
SetSE<AnnotationSE> getStereotypeDefinition(ClassSE<? extends AnnotationSE> stereotype)
特定のステレオタイプのメタアノテーションを取得します。- パラメーター:
stereotype- ステレオタイプ- 戻り値:
- メタアノテーションのセット
areQualifiersEquivalent
boolean areQualifiersEquivalent(AnnotationSE qualifier1, AnnotationSE qualifier2)
Nonbindingでアノテーションが付けられたメンバーを考慮して、2 つの修飾子が型安全な解決の目的で同等と見なされるかどうかを判断します。- パラメーター:
qualifier1- チェックする修飾子qualifier2- チェックする修飾子- 戻り値:
- 2 つの修飾子が同等の場合は true、そうでない場合は false
- 導入:
- 1.1
areInterceptorBindingsEquivalent
boolean areInterceptorBindingsEquivalent(AnnotationSE interceptorBinding1, AnnotationSE interceptorBinding2)
Nonbindingでアノテーションが付けられたメンバーを考慮して、2 つのインターセプターバインディングが型安全な解決の目的で同等と見なされるかどうかを判断します。- パラメーター:
interceptorBinding1- チェックするインターセプターバインディングinterceptorBinding2- チェックするインターセプターバインディング- 戻り値:
- 2 つのインターセプターバインディングが同等の場合は true、それ以外の場合は false
- 導入:
- 1.1
getQualifierHashCode
int getQualifierHashCode(AnnotationSE qualifier)
アノテーションハッシュコードを決定するための JDK アルゴリズムを使用して、Nonbindingでアノテーションされたメンバーを無視して、修飾子のハッシュコードを決定します。- パラメーター:
qualifier- 考慮すべき修飾子- 戻り値:
- 予選の hashCode
- 導入:
- 1.1
getInterceptorBindingHashCode
int getInterceptorBindingHashCode(AnnotationSE interceptorBinding)
JDK アルゴリズムを使用してアノテーションハッシュコードを決定し、Nonbindingでアノテーションされたメンバーを無視して、インターセプターバインディングのハッシュコードを決定します。- パラメーター:
interceptorBinding- 考慮すべきインターセプターバインディング- 戻り値:
- インターセプターバインディングの hashCode
- 導入:
- 1.1
getELResolver
ELResolver getELResolver()
EL 名で Bean を解決するELResolverを返します。- 戻り値:
ELResolver
wrapExpressionFactory
ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
MethodExpressionおよびValueExpressionの作成を指定されたExpressionFactoryに委譲するラッパーExpressionFactoryを返します。ラッパーExpressionFactoryによって返されるMethodExpressionまたはValueExpressionを使用して UnifiedEL 式が評価される場合、コンテナーはスコープDependentを持つオブジェクトの破棄を処理します。- パラメーター:
expressionFactory- ラップするExpressionFactory- 戻り値:
- ラップされた
ExpressionFactory
createAnnotatedType
<T> AnnotatedType<T> createAnnotatedType(ClassSE<T> type)
指定されたクラスまたはインターフェースのアノテーションを読み取るために使用できるAnnotatedTypeを取得します。- 型パラメーター:
T- クラスまたはインターフェース- パラメーター:
type-ClassSE オブジェクト- 戻り値:
AnnotatedType
getInjectionTargetFactory
<T> InjectionTargetFactory<T> getInjectionTargetFactory(AnnotatedType<T> annotatedType)
コンテナーが作成した
InjectionTargetインスタンスを提供するInjectionTargetFactoryの実装。このファクトリをラップして、コンテナーで作成されたインジェクションターゲットに動作を追加できます。
- 型パラメーター:
T- 型- パラメーター:
annotatedType- 注入ターゲットファクトリを作成するためのアノテーション付き型- 戻り値:
InjectionTargetFactory- 導入:
- 1.1
getProducerFactory
<X> ProducerFactory<X> getProducerFactory(AnnotatedField<? super X> field, Bean<X> declaringBean)
指定されたフィールドに対してコンテナーが作成した
Producerインスタンスを提供するProducerFactoryの実装。このファクトリをラップして、コンテナーで作成されたプロデューサーに動作を追加できます。
- 型パラメーター:
X- 宣言型- パラメーター:
field- プロデューサーファクトリを作るためのフィールドdeclaringBean- プロデューサーを宣言する Bean。プロデューサーが静的であるか、宣言オブジェクトが非コンテキストである場合、null になる可能性があります- 戻り値:
- フィールドのプロデューサーファクトリ
- 導入:
- 1.1
getProducerFactory
<X> ProducerFactory<X> getProducerFactory(AnnotatedMethod<? super X> method, Bean<X> declaringBean)
指定されたメソッドに対してコンテナーが作成した
Producerインスタンスを提供するProducerFactoryの実装。このファクトリをラップして、コンテナーで作成されたプロデューサーに動作を追加できます。
- 型パラメーター:
X- Bean 型- パラメーター:
method- プロデューサーファクトリを作成する方法declaringBean- プロデューサーを宣言する Bean。プロデューサーが静的であるか、宣言オブジェクトが非コンテキストである場合、null になる可能性があります- 戻り値:
- メソッドのプロデューサーファクトリ
- 導入:
- 1.1
createBeanAttributes
<T> BeanAttributes<T> createBeanAttributes(AnnotatedType<T> type)
指定されたAnnotatedTypeのBeanAttributesを取得します。コンテナーは、実際の Java クラスの要素によって宣言されたアノテーションと型を無視し、代わりにAnnotatedインターフェースを介して提供されるメタデータを使用します。- 型パラメーター:
T- 型- パラメーター:
type-AnnotatedType- 戻り値:
- コンテナーが提供する
InjectionTargetの実装 - 導入:
- 1.1
createBeanAttributes
BeanAttributes<?> createBeanAttributes(AnnotatedMember<?> type)
指定されたAnnotatedTypeのBeanAttributesを取得します。コンテナーは、実際の Java クラスの要素によって宣言されたアノテーションと型を無視し、代わりにAnnotatedインターフェースを介して提供されるメタデータを使用します。- パラメーター:
type-AnnotatedType- 戻り値:
- コンテナーが提供する
InjectionTargetの実装 - 導入:
- 1.1
createBean
<T> Bean<T> createBean(BeanAttributes<T> attributes, ClassSE<T> beanClass, InjectionTargetFactory<T> injectionTargetFactory)
指定された
BeanAttributes、Bean クラス、InjectionTargetのBeanを取得します。InjectionTargetは、Bean のインスタンスを作成および破棄し、依存性注入とライフサイクルコールバックを実行し、Bean.getInjectionPoints()の戻り値を決定します。InjectionTargetはInjectionTargetFactoryから取得されます。getInjectionTargetFactory(AnnotatedType)では、InjectionTargetで作成されたコンテナーを使用できます。- 型パラメーター:
T- 型- パラメーター:
attributes- 返されたBeanの Bean 型、修飾子、スコープ、名前、ステレオタイプ、BeanAttributes.isAlternative()の戻り値を決定するBeanAttributesbeanClass-Bean.getBeanClass()の戻り値を決定するクラスinjectionTargetFactory-InjectionTargetを取得するために使用されるInjectionTargetFactory- 戻り値:
- コンテナーが提供する
Beanの実装 - 導入:
- 1.1
createBean
<T,X> Bean<T> createBean(BeanAttributes<T> attributes, ClassSE<X> beanClass, ProducerFactory<X> producerFactory)
指定された
BeanAttributes、Bean クラス、ProducerのBeanを取得します。Producerは、デコレータのインスタンスを作成および破棄し、Bean.getInjectionPoints()の戻り値を決定します。ProducerはProducerFactoryから取得されます。getProducerFactory(AnnotatedMethod, Bean)またはgetProducerFactory(AnnotatedField, Bean)では、Producerで作成されたコンテナーを使用できます。- 型パラメーター:
T- 型X- 宣言する Bean の型- パラメーター:
attributes- 返されたBeanの Bean 型、修飾子、スコープ、名前、ステレオタイプ、BeanAttributes.isAlternative()の戻り値を決定するBeanAttributesbeanClass-Bean.getClass()の戻り値を決定するクラスproducerFactory-Producerを取得するために使用されるProducerFactory- 戻り値:
- コンテナーが提供する
Beanの実装 - 導入:
- 1.1
createInjectionPoint
InjectionPoint createInjectionPoint(AnnotatedField<?> field)
指定されたAnnotatedFieldのInjectionPointのコンテナー提供の実装を取得します。- パラメーター:
field- 注入位置を定義するAnnotatedField- 戻り値:
- 提供されたコンテナー
InjectionPoint - 例外:
IllegalArgumentExceptionSE- インジェクションポイントに関連する定義エラーがある場合- 導入:
- 1.1
createInjectionPoint
InjectionPoint createInjectionPoint(AnnotatedParameter<?> parameter)
指定されたAnnotatedParameterのInjectionPointのコンテナー提供の実装を取得します。- パラメーター:
parameter- 注入位置を定義するAnnotatedParameter- 戻り値:
- 提供されたコンテナー
InjectionPoint - 例外:
IllegalArgumentExceptionSE- インジェクションポイントに関連する定義エラーがある場合- 導入:
- 1.1
getExtension
<T extends Extension> T getExtension(ClassSE<T> extensionClass)
META-INF/servicesで宣言された Extension クラスのコンテナーのインスタンスを取得します。- 型パラメーター:
T- 拡張機能の型- パラメーター:
extensionClass- 拡張クラスの型- 戻り値:
- 拡張インスタンス
- 例外:
IllegalArgumentExceptionSE- コンテナーに特定のクラスのインスタンスがない場合- 導入:
- 1.1
createInterceptionFactory
<T> InterceptionFactory<T> createInterceptionFactory(CreationalContext<T> ctx, ClassSE<T> clazz)
指定されたCreationalContextと型のInterceptionFactoryを作成します。- 型パラメーター:
T- このファクトリが動作するインスタンスの型- パラメーター:
ctx-InterceptionFactoryが作成するCreationalContextclazz- このファクトリが動作するインスタンスのクラス- 戻り値:
- T のインスタンスにサービスを追加するための新しい
InterceptionFactory - 導入:
- 2.0
getInjectableReference
ObjectSE getInjectableReference(InjectionPoint ij, CreationalContext<?> ctx)
特定のインジェクションポイントの注入可能な参照を取得します。
- パラメーター:
ij- ゴール噴射点ctx- 作成されたスコープDependentのオブジェクトを破棄するために使用できるCreationalContext- 戻り値:
- 注入可能な参照
- 例外:
UnsatisfiedResolutionException- 型安全な解決の結果、依存関係が満たされない場合AmbiguousResolutionException- 型安全な解決により、解決できないあいまいな依存関係が発生するIllegalStateExceptionSE- アプリケーションの初期化中に呼び出された場合、AfterDeploymentValidationイベントが発生する前。