Package org.jboss.weld
Class AbstractCDI<T>
java.lang.Object
jakarta.enterprise.inject.spi.CDI<T>
org.jboss.weld.AbstractCDI<T>
- Type Parameters:
T-
- All Implemented Interfaces:
jakarta.enterprise.inject.Instance<T>,jakarta.inject.Provider<T>,Iterable<T>,WeldInstance<T>
- Direct Known Subclasses:
SimpleCDI
public abstract class AbstractCDI<T>
extends jakarta.enterprise.inject.spi.CDI<T>
implements WeldInstance<T>
Abstract implementation of CDI which forwards all Instance methods to a delegate. Furthermore, it allows the calling class to
be identified using the
getCallingClassName() method.- Author:
- Jozef Hartinger
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.enterprise.inject.Instance
jakarta.enterprise.inject.Instance.Handle<T extends Object>Nested classes/interfaces inherited from interface org.jboss.weld.inject.WeldInstance
WeldInstance.Handler<T> -
Field Summary
FieldsFields inherited from class jakarta.enterprise.inject.spi.CDI
configuredProvider, discoveredProviders -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCheck whether the container is in a "valid" state, no-op by default.voidget()protected StringExaminesStackTraceElements to figure out which class invoked a method onCDI.jakarta.enterprise.inject.Instance.Handle<T>Comparator<jakarta.enterprise.inject.Instance.Handle<?>>The returned comparator sorts handles by priority in descending order.This method is deprecated as a similar functioning method exists in CDI 4.0 and newer.protected WeldInstance<T>Subclasses are allowed to override the default behavior, i.e. to cache an instance per BeanManager.This method is deprecated in favor ofWeldInstance.getHandlePriorityComparator()which operates on a non-deprecatedInstance.Handleinterface.handlers()This method is deprecated as a similar functioning method exists in CDI 4.0 and newer.handles()booleanbooleanbooleaniterator()<U extends T>
WeldInstance<U>select(jakarta.enterprise.util.TypeLiteral<U> subtype, Annotation... qualifiers) select(Annotation... qualifiers) <U extends T>
WeldInstance<U>select(Class<U> subtype, Annotation... qualifiers) <X> WeldInstance<X>select(Type subtype, Annotation... qualifiers) Obtains a childInstancefor the given required type and additional required qualifiers.Methods inherited from class jakarta.enterprise.inject.spi.CDI
current, getBeanContainer, getBeanManager, setCDIProviderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.enterprise.inject.Instance
handlesStream, streamMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.jboss.weld.inject.WeldInstance
handlersStream
-
Field Details
-
knownClassNames
-
-
Constructor Details
-
AbstractCDI
public AbstractCDI()
-
-
Method Details
-
iterator
-
get
- Specified by:
getin interfacejakarta.inject.Provider<T>
-
select
- Specified by:
selectin interfacejakarta.enterprise.inject.Instance<T>- Specified by:
selectin interfaceWeldInstance<T>
-
select
- Specified by:
selectin interfacejakarta.enterprise.inject.Instance<T>- Specified by:
selectin interfaceWeldInstance<T>
-
select
public <U extends T> WeldInstance<U> select(jakarta.enterprise.util.TypeLiteral<U> subtype, Annotation... qualifiers) - Specified by:
selectin interfacejakarta.enterprise.inject.Instance<T>- Specified by:
selectin interfaceWeldInstance<T>
-
select
Description copied from interface:WeldInstanceObtains a child
Instancefor the given required type and additional required qualifiers. Must be invoked onInstance<T>where T isObject.- Specified by:
selectin interfaceWeldInstance<T>- Type Parameters:
X- the required type- Parameters:
subtype- aTyperepresenting the required typequalifiers- the additional required qualifiers- Returns:
- the child
Instance
-
isUnsatisfied
public boolean isUnsatisfied()- Specified by:
isUnsatisfiedin interfacejakarta.enterprise.inject.Instance<T>
-
isAmbiguous
public boolean isAmbiguous()- Specified by:
isAmbiguousin interfacejakarta.enterprise.inject.Instance<T>
-
destroy
- Specified by:
destroyin interfacejakarta.enterprise.inject.Instance<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
-
getHandle
- Specified by:
getHandlein interfacejakarta.enterprise.inject.Instance<T>
-
isResolvable
public boolean isResolvable()- Specified by:
isResolvablein interfacejakarta.enterprise.inject.Instance<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
-
handles
- Specified by:
handlesin interfacejakarta.enterprise.inject.Instance<T>
-
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
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
-
getCallingClassName
ExaminesStackTraceElements to figure out which class invoked a method onCDI. -
getInstance
Subclasses are allowed to override the default behavior, i.e. to cache an instance per BeanManager.- Returns:
- the
Instancethe relevant calls are delegated to
-
checkState
protected void checkState()Check whether the container is in a "valid" state, no-op by default.Subclasses are allowed to override the default behavior, i.e. to check whether a container is running.
-