Package org.apache.webbeans.util
Class WebBeansUtil
java.lang.Object
org.apache.webbeans.util.WebBeansUtil
Contains some utility methods used in the all project.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckGenericType(Class<?> clazz, Class<? extends Annotation> scope) Checks the generic type requirements.static voidcheckInjectionPointNamedQualifier(jakarta.enterprise.inject.spi.InjectionPoint injectionPoint) voidcheckManagedBean(Class<?> clazz) Returns true if this class can be candidate for simple web bean, false otherwise.<X> voidcheckManagedBeanCondition(jakarta.enterprise.inject.spi.AnnotatedType<X> type) Checks the implementation class for checking conditions.voidcheckManagedBeanCondition(Class<?> clazz) static voidcheckNullInstance(Object instance, Class<?> scopeType, String errorMessage, Object... errorMessageArgs) static booleancheckObtainsInjectionPointConditions(jakarta.enterprise.inject.spi.InjectionPoint injectionPoint) Returns true if instance injection point false otherwise.static voidcheckProducerGenericType(jakarta.enterprise.inject.spi.Bean<?> bean, Member member) Check producer method/field bean return type.voidcheckSerializableScopeType(Class<? extends Annotation> scopeType, boolean isSerializable, String errorMessage, Object... errorMessageArgs) voidcheckTypeVariables(jakarta.enterprise.util.TypeLiteral<?> subtype) <T> ManagedBean<T>defineManagedBeanWithoutFireEvents(jakarta.enterprise.inject.spi.AnnotatedType<T> type) This method will be used inAfterBeanDiscovery.addBean(jakarta.enterprise.inject.spi.Bean)}fireProcessAnnotatedTypeEvent(jakarta.enterprise.inject.spi.AnnotatedType<T> annotatedType) ReturnsProcessAnnotatedTypeevent.<T> ProcessBeanAttributesImpl<T>fireProcessBeanAttributes(jakarta.enterprise.inject.spi.Annotated annotatedType, Class<?> type, jakarta.enterprise.inject.spi.BeanAttributes<T> ba) fireProcessInjectionPointEvent(jakarta.enterprise.inject.spi.InjectionPoint injectionPoint) fireProcessInjectionTargetEvent(InjectionTargetImpl<T> injectionTarget, jakarta.enterprise.inject.spi.AnnotatedType<T> annotatedType) ReturnsProcessInjectionTargetevent.fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass) ReturnsProcessInjectionTargetevent.<T> jakarta.enterprise.inject.spi.Producer<T>fireProcessProducerEvent(jakarta.enterprise.inject.spi.Producer<T> producer, jakarta.enterprise.inject.spi.AnnotatedMember<?> annotatedMember) voidfireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>, jakarta.enterprise.inject.spi.AnnotatedField<?>> annotatedFields) voidfireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>, jakarta.enterprise.inject.spi.AnnotatedMethod<?>> annotatedMethods, jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) fireProcessSyntheticAnnotatedTypeEvent(jakarta.enterprise.inject.spi.AnnotatedType<T> annotatedType) ReturnsProcessAnnotatedTypeevent.<T> BeanMetadataBean<T>Creates a new bean metadata bean.Returns new conversation bean instance.static ClassLoaderGets current classloader with current thread.<T> DecoratorMetadataBean<T>Creates a new decorator metadata bean.<T> EventBean<T>Creates a new event bean.Creates a new event bean.<T> jakarta.enterprise.inject.spi.AnnotatedConstructor<T>getInjectedConstructor(jakarta.enterprise.inject.spi.AnnotatedType<T> type) Returns a new injected point bean instance.<T> InstanceBean<T>Creates a new instance bean.Creates a new metadata bean.<T> InterceptorMetadataBean<T>Creates a new interceptor metadata bean.Creates a new manager bean instance.static jakarta.enterprise.inject.spi.Bean<?>getMostSpecializedBean(jakarta.enterprise.inject.spi.BeanManager manager, jakarta.enterprise.inject.spi.Bean<?> component) <T> Constructor<T>getNoArgConstructor(Class<T> clazz) static StringgetPassivationId(jakarta.enterprise.context.spi.Contextual<?> contextual) Creates a new bean metadata bean.Creates a new bean for Request Context Controllerjakarta.enterprise.inject.spi.Interceptor<?>Creates a new bean for Request Context Interceptor.jakarta.annotation.PrioritygetStereotypePriority(Class<? extends Annotation> stereotype, Set<Class<? extends Annotation>> stereotypes) voidinspectDefinitionErrorStack(String logMessage) voidinspectDeploymentErrorStack(String logMessage) static booleanisAlternative(jakarta.enterprise.inject.spi.Annotated annotated, Set<Class<? extends Annotation>> stereotypes) booleanisAnnotatedTypeDecoratorOrInterceptor(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) Return true if this annotated type represents a decorator.booleanisBeanEnabled(jakarta.enterprise.inject.spi.AnnotatedType<?> at, Set<Class<? extends Annotation>> stereotypes) booleanisBeanEnabled(jakarta.enterprise.inject.spi.BeanAttributes<?> beanAttributes, jakarta.enterprise.inject.spi.AnnotatedType<?> at, Set<Class<? extends Annotation>> stereotypes) static booleanisCdiInterceptor(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) booleanisConstructorOk(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) Check that simple web beans class has compatible constructor.booleanisContainerEventType(Class<?> type) booleanisContainerEventType(Object event) static booleanisDecorator(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) static booleanisDefaultExtensionBeanEventType(Class<?> clazz) static booleanstatic booleanisDependent(jakarta.enterprise.inject.spi.Bean<?> bean) static booleanisExtensionBeanEventType(Type type) static booleanbooleanisPassivationCapableDependency(jakarta.enterprise.inject.spi.InjectionPoint injectionPoint) booleanisStereotypeWithPriority(Class<? extends Annotation> stereotype, Set<Class<? extends Annotation>> stereotypes) voidsetBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent, AbstractProducerBean<?> producer, Annotation[] annotations) voidSets bean enabled flag.booleansupportsJavaEeComponentInjections(Class<?> clazz) Returns true if given class supports injections, false otherwise.static voidvoidvalidate(Set<jakarta.enterprise.inject.spi.InjectionPoint> injectionPoints, jakarta.enterprise.inject.spi.Bean<?> bean) voidvalidateBeanInjection(jakarta.enterprise.inject.spi.Bean<?> bean) voidvalidEventType(Type eventType, Type metadataType)
-
Constructor Details
-
WebBeansUtil
-
-
Method Details
-
getCurrentClassLoader
Gets current classloader with current thread.- Returns:
- Current class loader instance
-
checkGenericType
Checks the generic type requirements. -
checkProducerGenericType
public static void checkProducerGenericType(jakarta.enterprise.inject.spi.Bean<?> bean, Member member) Check producer method/field bean return type.- Parameters:
bean- producer bean instancemember- related member instance
-
checkManagedBean
Returns true if this class can be candidate for simple web bean, false otherwise.- Parameters:
clazz- implementation class- Throws:
WebBeansConfigurationException- if any configuration exception occurs
-
checkManagedBeanCondition
- Throws:
WebBeansConfigurationException
-
supportsJavaEeComponentInjections
Returns true if given class supports injections, false otherwise.Each plugin is asked with given class that supports injections or not.
- Parameters:
clazz- scanned class- Returns:
- true if given class supports injections
-
isConstructorOk
public boolean isConstructorOk(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) throws WebBeansConfigurationException Check that simple web beans class has compatible constructor.- Parameters:
annotatedType- web beans annotatedType- Throws:
WebBeansConfigurationException- if the web beans has incompatible constructor
-
getInjectedConstructor
public <T> jakarta.enterprise.inject.spi.AnnotatedConstructor<T> getInjectedConstructor(jakarta.enterprise.inject.spi.AnnotatedType<T> type) -
getManagerBean
Creates a new manager bean instance.- Returns:
- new manager bean instance
-
getRequestContextControllerBean
Creates a new bean for Request Context Controller- Returns:
- new request context controller bean instance
-
getRequestContextInterceptorBean
public jakarta.enterprise.inject.spi.Interceptor<?> getRequestContextInterceptorBean()Creates a new bean for Request Context Interceptor.- Returns:
- new request context interceptor bean instance
-
getInstanceBean
Creates a new instance bean.- Returns:
- new instance bean
-
getEventBean
Creates a new event bean.- Returns:
- new event bean
-
getEventMetadataBean
Creates a new event bean.- Returns:
- new event bean
-
getBeanMetadataBean
Creates a new bean metadata bean.- Returns:
- new bean
-
getPrincipalBean
Creates a new bean metadata bean.- Returns:
- new bean
-
getInterceptorMetadataBean
Creates a new interceptor metadata bean.- Returns:
- new bean
-
getDecoratorMetadataBean
Creates a new decorator metadata bean.- Returns:
- new bean
-
getInterceptedOrDecoratedBeanMetadataBean
Creates a new metadata bean.- Returns:
- new bean
-
getConversationBean
Returns new conversation bean instance. The name is explicitly specified in 6.7.2 and is not the normal default name.- Returns:
- new conversation bean
-
getInjectionPointBean
Returns a new injected point bean instance.- Returns:
- new injected point bean
-
getNoArgConstructor
-
checkObtainsInjectionPointConditions
public static boolean checkObtainsInjectionPointConditions(jakarta.enterprise.inject.spi.InjectionPoint injectionPoint) Returns true if instance injection point false otherwise.- Parameters:
injectionPoint- injection point definition- Returns:
- true if instance injection point
-
checkNullInstance
-
checkSerializableScopeType
public void checkSerializableScopeType(Class<? extends Annotation> scopeType, boolean isSerializable, String errorMessage, Object... errorMessageArgs) -
getMostSpecializedBean
public static jakarta.enterprise.inject.spi.Bean<?> getMostSpecializedBean(jakarta.enterprise.inject.spi.BeanManager manager, jakarta.enterprise.inject.spi.Bean<?> component) -
fireProcessAnnotatedTypeEvent
public <T> GProcessAnnotatedType fireProcessAnnotatedTypeEvent(jakarta.enterprise.inject.spi.AnnotatedType<T> annotatedType) ReturnsProcessAnnotatedTypeevent.- Type Parameters:
T- bean type- Parameters:
annotatedType- bean class- Returns:
- event
-
fireProcessSyntheticAnnotatedTypeEvent
public <T> GProcessSyntheticAnnotatedType fireProcessSyntheticAnnotatedTypeEvent(jakarta.enterprise.inject.spi.AnnotatedType<T> annotatedType) ReturnsProcessAnnotatedTypeevent.- Type Parameters:
T- bean type- Parameters:
annotatedType- bean class- Returns:
- event
-
fireProcessInjectionPointEvent
public GProcessInjectionPoint fireProcessInjectionPointEvent(jakarta.enterprise.inject.spi.InjectionPoint injectionPoint) - Parameters:
injectionPoint- the originalInjectionPoint- Returns:
- fired
ProcessInjectionPointevent
-
fireProcessInjectionTargetEvent
public <T> GProcessInjectionTarget fireProcessInjectionTargetEvent(InjectionTargetImpl<T> injectionTarget, jakarta.enterprise.inject.spi.AnnotatedType<T> annotatedType) ReturnsProcessInjectionTargetevent.- Type Parameters:
T- bean type- Returns:
- event
-
fireProcessInjectionTargetEventForJavaEeComponents
public <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass) ReturnsProcessInjectionTargetevent.- Type Parameters:
T- bean type- Returns:
- event
-
fireProcessProducerEvent
public <T> jakarta.enterprise.inject.spi.Producer<T> fireProcessProducerEvent(jakarta.enterprise.inject.spi.Producer<T> producer, jakarta.enterprise.inject.spi.AnnotatedMember<?> annotatedMember) -
fireProcessProducerMethodBeanEvent
public void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>, jakarta.enterprise.inject.spi.AnnotatedMethod<?>> annotatedMethods, jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) -
fireProcessProducerFieldBeanEvent
public void fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>, jakarta.enterprise.inject.spi.AnnotatedField<?>> annotatedFields) -
checkInjectionPointNamedQualifier
public static void checkInjectionPointNamedQualifier(jakarta.enterprise.inject.spi.InjectionPoint injectionPoint) -
setInjectionTargetBeanEnableFlag
Sets bean enabled flag.- Parameters:
bean- bean instance
-
isBeanEnabled
public boolean isBeanEnabled(jakarta.enterprise.inject.spi.BeanAttributes<?> beanAttributes, jakarta.enterprise.inject.spi.AnnotatedType<?> at, Set<Class<? extends Annotation>> stereotypes) -
isBeanEnabled
public boolean isBeanEnabled(jakarta.enterprise.inject.spi.AnnotatedType<?> at, Set<Class<? extends Annotation>> stereotypes) -
isStereotypeWithPriority
public boolean isStereotypeWithPriority(Class<? extends Annotation> stereotype, Set<Class<? extends Annotation>> stereotypes) -
getStereotypePriority
public jakarta.annotation.Priority getStereotypePriority(Class<? extends Annotation> stereotype, Set<Class<? extends Annotation>> stereotypes) -
isAlternative
public static boolean isAlternative(jakarta.enterprise.inject.spi.Annotated annotated, Set<Class<? extends Annotation>> stereotypes) -
setBeanEnableFlagForProducerBean
public void setBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent, AbstractProducerBean<?> producer, Annotation[] annotations) -
isExtensionBeanEventType
-
isDefaultExtensionBeanEventType
-
isExtensionProducerOrObserverEventType
-
isDefaultExtensionProducerOrObserverEventType
-
isDependent
public static boolean isDependent(jakarta.enterprise.inject.spi.Bean<?> bean) -
inspectDefinitionErrorStack
-
inspectDeploymentErrorStack
-
getPassivationId
- Parameters:
contextual- theBeanto check- Returns:
- the uniqueId if it is
PassivationCapableand enabled
-
defineManagedBeanWithoutFireEvents
public <T> ManagedBean<T> defineManagedBeanWithoutFireEvents(jakarta.enterprise.inject.spi.AnnotatedType<T> type) This method will be used inAfterBeanDiscovery.addBean(jakarta.enterprise.inject.spi.Bean)} -
isPassivationCapableDependency
public boolean isPassivationCapableDependency(jakarta.enterprise.inject.spi.InjectionPoint injectionPoint) -
throwRuntimeExceptions
-
isDecorator
public static boolean isDecorator(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) - Returns:
trueif this annotated type represents a decorator.
-
isAnnotatedTypeDecoratorOrInterceptor
public boolean isAnnotatedTypeDecoratorOrInterceptor(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) Return true if this annotated type represents a decorator.- Parameters:
annotatedType- annotated type- Returns:
- true if decorator
-
isCdiInterceptor
public static boolean isCdiInterceptor(jakarta.enterprise.inject.spi.AnnotatedType<?> annotatedType) - Returns:
trueif this AnnotatedType represents a CDI Interceptor defined via aInterceptorannotation
-
checkManagedBeanCondition
public <X> void checkManagedBeanCondition(jakarta.enterprise.inject.spi.AnnotatedType<X> type) throws WebBeansConfigurationException Checks the implementation class for checking conditions.- Parameters:
type- implementation class- Throws:
WebBeansConfigurationException- if any configuration exception occurs
-
validate
public void validate(Set<jakarta.enterprise.inject.spi.InjectionPoint> injectionPoints, jakarta.enterprise.inject.spi.Bean<?> bean) -
checkTypeVariables
public void checkTypeVariables(jakarta.enterprise.util.TypeLiteral<?> subtype) -
validEventType
-
isContainerEventType
-
isContainerEventType
-
fireProcessBeanAttributes
public <T> ProcessBeanAttributesImpl<T> fireProcessBeanAttributes(jakarta.enterprise.inject.spi.Annotated annotatedType, Class<?> type, jakarta.enterprise.inject.spi.BeanAttributes<T> ba) -
validateBeanInjection
public void validateBeanInjection(jakarta.enterprise.inject.spi.Bean<?> bean) -
getInterceptionFactoryCache
-
getInterceptionFactoryBean
-