Class ForwardingWeldInstance<T>
- java.lang.Object
-
- org.jboss.weld.util.ForwardingWeldInstance<T>
-
- All Implemented Interfaces:
Instance<T>,Provider<T>,Iterable<T>,WeldInstance<T>
public abstract class ForwardingWeldInstance<T> extends Object implements WeldInstance<T>
Forwarding implementation ofInstance.- Author:
- Martin Kouba
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jakarta.enterprise.inject.Instance
Instance.Handle<T>
-
Nested classes/interfaces inherited from interface org.jboss.weld.inject.WeldInstance
WeldInstance.Handler<T>
-
-
Constructor Summary
Constructors Constructor Description ForwardingWeldInstance()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract WeldInstance<T>delegate()voiddestroy(T instance)When called, the container destroys the instance if the active context object for the scope type of the bean supports destroying bean instances.Tget()Provides a fully-constructed and injected instance ofT.Instance.HandlegetHandle()Obtains an initialized contextual reference handle for a bean that has the required type and qualifiers and is eligible for injection.Comparator<Instance.Handle<?>>getHandlePriorityComparator()The returned comparator sorts handles by priority in descending order.WeldInstance.Handler<T>getHandler()This method is deprecated as a similar functioning method exists in CDI 4.0 and newer.Comparator<WeldInstance.Handler<?>>getPriorityComparator()This method is deprecated in favor ofWeldInstance.getHandlePriorityComparator()which operates on a non-deprecatedInstance.Handleinterface.Iterable<WeldInstance.Handler<T>>handlers()This method is deprecated as a similar functioning method exists in CDI 4.0 and newer.Iterable<? extends Instance.Handle<T>>handles()Allows iterating over contextual reference handles for all beans that have the required type and required qualifiers and are eligible for injection.booleanisAmbiguous()Determines if there is more than one bean that matches the required type and qualifiers and is eligible for injection into the class into which the parentInstancewas injected.booleanisUnsatisfied()Determines if there is no bean that matches the required type and qualifiers and is eligible for injection into the class into which the parentInstancewas injected.Iterator<T>iterator()<U extends T>
WeldInstance<U>select(TypeLiteral<U> subtype, Annotation... qualifiers)Obtains a childInstancefor the given required type and additional required qualifiers.WeldInstance<T>select(Annotation... qualifiers)Obtains a childInstancefor the given additional required qualifiers.<U extends T>
WeldInstance<U>select(Class<U> subtype, Annotation... qualifiers)Obtains a childInstancefor the given required type and additional required qualifiers.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.enterprise.inject.Instance
handlesStream, isResolvable, stream
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.jboss.weld.inject.WeldInstance
handlersStream, select
-
-
-
-
Method Detail
-
delegate
public abstract WeldInstance<T> delegate()
-
get
public T get()
Description copied from interface:ProviderProvides a fully-constructed and injected instance ofT.
-
select
public WeldInstance<T> select(Annotation... qualifiers)
Description copied from interface:InstanceObtains a child
Instancefor the given additional required qualifiers.
-
select
public <U extends T> WeldInstance<U> select(Class<U> subtype, Annotation... qualifiers)
Description copied from interface:InstanceObtains a child
Instancefor the given required type and additional required qualifiers.
-
select
public <U extends T> WeldInstance<U> select(TypeLiteral<U> subtype, Annotation... qualifiers)
Description copied from interface:InstanceObtains a child
Instancefor the given required type and additional required qualifiers.- Specified by:
selectin interfaceInstance<T>- Specified by:
selectin interfaceWeldInstance<T>- Type Parameters:
U- the required type- Parameters:
subtype- aTypeLiteralrepresenting the required typequalifiers- the additional required qualifiers- Returns:
- the child
Instance
-
isUnsatisfied
public boolean isUnsatisfied()
Description copied from interface:InstanceDetermines if there is no bean that matches the required type and qualifiers and is eligible for injection into the class into which the parent
Instancewas injected.- Specified by:
isUnsatisfiedin interfaceInstance<T>- Returns:
trueif there is no bean that matches the required type and qualifiers and is eligible for injection into the class into which the parentInstancewas injected, orfalseotherwise.
-
isAmbiguous
public boolean isAmbiguous()
Description copied from interface:InstanceDetermines if there is more than one bean that matches the required type and qualifiers and is eligible for injection into the class into which the parent
Instancewas injected.- Specified by:
isAmbiguousin interfaceInstance<T>- Returns:
trueif there is more than one bean that matches the required type and qualifiers and is eligible for injection into the class into which the parentInstancewas injected, orfalseotherwise.
-
destroy
public void destroy(T instance)
Description copied from interface:InstanceWhen called, the container destroys the instance if the active context object for the scope type of the bean supports destroying bean instances. All normal scoped built-in contexts support destroying bean instances.
The instance passed should either be a dependent scoped bean instance obtained from the same
Instanceobject, or the client proxy for a normal scoped bean instance.
-
getHandler
public WeldInstance.Handler<T> getHandler()
Description copied from interface:WeldInstanceThis method is deprecated as a similar functioning method exists in CDI 4.0 and newer. Users should instead useInstance.getHandle(). Obtains an initialized contextual reference handler for the bean that has the required type and required qualifiers and is eligible for injection.The contextual reference is obtained lazily, i.e. when first needed.
- Specified by:
getHandlerin interfaceWeldInstance<T>- Returns:
- a new handler
-
handlers
public Iterable<WeldInstance.Handler<T>> handlers()
Description copied from interface:WeldInstanceThis method is deprecated as a similar functioning method exists in CDI 4.0 and newer. Users should instead useInstance.handles(). Allows to iterate over contextual reference handlers for all the beans that have the required type and required qualifiers and are eligible for injection.Note that the returned
Iterableis stateless and so eachIterable.iterator()produces a new set of handlers.- Specified by:
handlersin interfaceWeldInstance<T>- Returns:
- a new iterable
-
getHandle
public Instance.Handle getHandle()
Description copied from interface:InstanceObtains an initialized contextual reference handle for a bean that has the required type and qualifiers and is eligible for injection. Throws exceptions if there is no such bean or more than one.The contextual reference is obtained lazily, i.e. when first needed.
- Specified by:
getHandlein interfaceInstance<T>- Returns:
- a new
Instance.Handleinstnace
-
handles
public Iterable<? extends Instance.Handle<T>> handles()
Description copied from interface:InstanceAllows iterating over contextual reference handles for all beans that have the required type and required qualifiers and are eligible for injection.Note that the returned
Iterableis stateless. Therefore, eachIterable.iterator()produces a new set of handles.
-
getPriorityComparator
public Comparator<WeldInstance.Handler<?>> getPriorityComparator()
Description copied from interface:WeldInstanceThis method is deprecated in favor ofWeldInstance.getHandlePriorityComparator()which operates on a non-deprecatedInstance.Handleinterface. The returned comparator sorts handlers by priority in descending order.- A class-based bean whose annotated type has
jakarta.annotation.Priorityhas the priority of valuejakarta.annotation.Priority#value() - A custom bean which implements
Prioritizedhas the priority of valuePrioritized.getPriority() - Any other bean has the priority of value 0
- Specified by:
getPriorityComparatorin interfaceWeldInstance<T>- Returns:
- a comparator instance
- A class-based bean whose annotated type has
-
getHandlePriorityComparator
public Comparator<Instance.Handle<?>> getHandlePriorityComparator()
Description copied from interface:WeldInstanceThe returned comparator sorts handles by priority in descending order.- A class-based bean whose annotated type has
jakarta.annotation.Priorityhas the priority of valuejakarta.annotation.Priority#value() - A custom bean which implements
Prioritizedhas the priority of valuePrioritized.getPriority() - Any other bean has the priority of value 0
- Specified by:
getHandlePriorityComparatorin interfaceWeldInstance<T>- Returns:
- a comparator instance
- A class-based bean whose annotated type has
-
-