public final class WebBeansUtil extends Object
| Constructor and Description |
|---|
WebBeansUtil(WebBeansContext webBeansContext) |
| Modifier and Type | Method and Description |
|---|---|
static <T> Method |
checkAroundInvokeAnnotationCriterias(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType,
Class<? extends Annotation> annot) |
static Method |
checkAroundInvokeAnnotationCriterias(Class<?> clazz,
Class<? extends Annotation> annot)
Check the
AroundInvoke annotated method criterias, and return
around invoke method. |
<T> Method |
checkCommonAnnotationCriterias(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType,
Class<? extends Annotation> commonAnnotation,
boolean invocationContext) |
Method |
checkCommonAnnotationCriterias(Class<?> clazz,
Class<? extends Annotation> commonAnnotation,
boolean invocationContext)
Check the
PostConstruct or PreDestroy annotated method
criterias, and return post construct or pre destroyDependents method. |
static void |
checkGenericType(javax.enterprise.inject.spi.Bean<?> bean)
Checks the generic type requirements.
|
static void |
checkInjectedMethodParameterConditions(Method method,
Class<?> clazz) |
static void |
checkInjectionPointNamedQualifier(javax.enterprise.inject.spi.InjectionPoint injectionPoint) |
<X> void |
checkManagedBeanCondition(javax.enterprise.inject.spi.AnnotatedType<X> type)
Checks the implementation class for checking conditions.
|
static void |
checkNullInstance(Object instance,
Class<?> scopeType,
String errorMessage,
Object... errorMessageArgs) |
static boolean |
checkObtainsInjectionPointConditions(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
Returns true if instance injection point false otherwise.
|
static void |
checkProducerGenericType(javax.enterprise.inject.spi.Bean<?> bean,
Member member)
Check producer method/field bean return type.
|
static void |
checkProducerMethodDisposal(Method disposalMethod,
String definedBeanClassName)
CheckProducerMethodDisposal.
|
static void |
checkProducerMethodForDeployment(Method method,
String parentImplClazzName)
Check producer method is ok for deployment.
|
void |
checkSerializableScopeType(Class<? extends Annotation> scopeType,
boolean isSerializable,
String errorMessage,
Object... errorMessageArgs) |
void |
checkUnproxiableApiType(javax.enterprise.inject.spi.Bean<?> bean,
Class<? extends Annotation> scopeType)
Checks the unproxiable condition.
|
protected void |
configSpecializedProducerMethodBeans(List<ProducerMethodBean> sortedProducerBeans)
Configure a list of producer method beans, which override the same method
and the bean classes are directly extended each other.
|
boolean |
configuredProducerSpecializedName(AbstractOwbBean<?> component,
Method method,
Method superMethod)
Configures the name of the producer method for specializing the parent.
|
<T> void |
configureInterceptorMethods(javax.enterprise.inject.spi.Interceptor<?> webBeansInterceptor,
javax.enterprise.inject.spi.AnnotatedType<T> annotatedType,
Class<? extends Annotation> annotation,
boolean definedInInterceptorClass,
boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod) |
void |
configureInterceptorMethods(javax.enterprise.inject.spi.Interceptor<?> webBeansInterceptor,
Class<?> interceptorClass,
Class<? extends Annotation> interceptionType,
boolean definedInInterceptorClass,
boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod,
boolean defineWithInterceptorBinding)
Configures the interceptor stack of the web beans component.
|
void |
configureProducerMethodSpecializations()
Configure direct/indirect specialized producer method beans.
|
static void |
configureProducerSpecialization(AbstractOwbBean<?> component,
Method method,
Class<?> superClass)
Configures the producer method specialization.
|
protected void |
configureSpecializations(Class<?> specializedClass,
List<Class<?>> beanClasses)
Configures the bean specializations.
|
void |
configureSpecializations(List<Class<?>> beanClasses) |
<T> ExtensionBean<T> |
createExtensionComponent(Class<T> clazz)
Creates a new extension bean.
|
<T> NewManagedBean<T> |
createNewComponent(Class<T> clazz,
Type apiType)
New WebBeans component class.
|
<T> GProcessInjectionTarget |
createProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean) |
<T> ManagedBean<T> |
defineAbstractDecorator(javax.enterprise.inject.spi.AnnotatedType<T> type) |
<T> ManagedBean<T> |
defineAbstractDecorator(ManagedBeanCreatorImpl<T> managedBeanCreator,
javax.enterprise.inject.spi.ProcessInjectionTarget<T> processInjectionTargetEvent) |
<T> Constructor<T> |
defineConstructor(Class<T> clazz)
Defines applicable constructor.
|
<T> Constructor<T> |
defineConstructor(Constructor<?>[] constructors,
Class<T> clazz) |
<T> void |
defineDecorator(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType)
Define decorator bean.
|
<T> void |
defineDecorator(ManagedBeanCreatorImpl<T> creator,
javax.enterprise.inject.spi.ProcessInjectionTarget<T> processInjectionTargetEvent)
Define decorator bean.
|
<T> void |
defineInterceptor(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType) |
<T> void |
defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator,
javax.enterprise.inject.spi.ProcessInjectionTarget<T> injectionTargetEvent) |
<T> ManagedBean<T> |
defineManagedBean(javax.enterprise.inject.spi.AnnotatedType<T> type) |
<T> ManagedBean<T> |
defineManagedBean(ManagedBeanCreatorImpl<T> managedBeanCreator,
javax.enterprise.inject.spi.ProcessInjectionTarget<T> processInjectionTargetEvent,
boolean allowLazyInit) |
<T> ManagedBean<T> |
defineManagedBeanWithoutFireEvents(javax.enterprise.inject.spi.AnnotatedType<T> type)
This method will be used in
AfterBeanDiscovery.addBean(javax.enterprise.inject.spi.Bean)} |
<T> GProcessAnnotatedType |
fireProcessAnnotatedTypeEvent(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType)
Returns
ProcessAnnotatedType event. |
<T> GProcessInjectionTarget |
fireProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
Returns
ProcessInjectionTarget event. |
GProcessInjectionTarget |
fireProcessInjectionTargetEvent(GProcessInjectionTarget processInjectionTargetEvent) |
<T> GProcessInjectionTarget |
fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
Returns
ProcessInjectionTarget event. |
void |
fireProcessObservableMethodBeanEvent(Map<javax.enterprise.inject.spi.ObserverMethod<?>,javax.enterprise.inject.spi.AnnotatedMethod<?>> annotatedMethods) |
GProcessProducer |
fireProcessProducerEventForField(ProducerFieldBean<?> producerField,
javax.enterprise.inject.spi.AnnotatedField<?> field) |
GProcessProducer |
fireProcessProducerEventForMethod(ProducerMethodBean<?> producerMethod,
javax.enterprise.inject.spi.AnnotatedMethod<?> method) |
void |
fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,javax.enterprise.inject.spi.AnnotatedField<?>> annotatedFields) |
void |
fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,javax.enterprise.inject.spi.AnnotatedMethod<?>> annotatedMethods,
javax.enterprise.inject.spi.AnnotatedType<?> annotatedType) |
ConversationBean |
getConversationBean()
Returns new conversation bean instance.
|
static ClassLoader |
getCurrentClassLoader()
Gets current classloader with current thread.
|
<T> EventBean<T> |
getEventBean()
Creates a new event bean.
|
InjectionPointBean |
getInjectionPointBean()
Returns a new injected point bean instance.
|
<T> InstanceBean<T> |
getInstanceBean()
Creates a new instance bean.
|
static String |
getManagedBeanDefaultName(String clazzName) |
BeanManagerBean |
getManagerBean()
Creates a new manager bean instance.
|
static javax.enterprise.inject.spi.Bean<?> |
getMostSpecializedBean(javax.enterprise.inject.spi.BeanManager manager,
javax.enterprise.inject.spi.Bean<?> component) |
static String |
getProducerDefaultName(String methodName) |
static boolean |
hasInjectionTargetBeanAnnotatedWithAlternative(InjectionTargetBean<?> bean) |
void |
inspectErrorStack(String logMessage) |
static boolean |
isAnnotatedTypeDecorator(javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)
Return true if this annotated type represents a decorator.
|
boolean |
isAnnotatedTypeDecoratorOrInterceptor(javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)
Return true if this annotated type represents a decorator.
|
static boolean |
isAnnotatedTypeInterceptor(javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)
Return true if this annotated type represents a decorator.
|
Set<javax.enterprise.inject.spi.Bean<?>> |
isConfiguredWebBeans(Class<?> clazz,
boolean annotate) |
boolean |
isConstructureOk(Class<?> clazz)
Check that simple web beans class has compatible constructor.
|
static boolean |
isContainsInterceptorMethod(List<InterceptorData> stack,
javax.enterprise.inject.spi.InterceptionType type)
Returns true if interceptor stack contains interceptor with given type.
|
static boolean |
isDefaultExtensionBeanEventType(Class<?> clazz) |
static boolean |
isDefaultExtensionProducerOrObserverEventType(Class<?> clazz) |
static boolean |
isDependent(javax.enterprise.inject.spi.Bean<?> bean) |
protected static boolean |
isDirectlySpecializedBeanSet(Set<javax.enterprise.inject.spi.Bean<?>> beans)
Return true if a list of beans are directly specialized/extended each other.
|
static boolean |
isExtensionBeanEventType(Class<?> clazz) |
static boolean |
isExtensionEventType(Class<?> clazz) |
static boolean |
isExtensionProducerOrObserverEventType(Class<?> clazz) |
void |
isManagedBeanClass(Class<?> clazz)
Return
true if the given class is ok for manage bean conditions,
false otherwise. |
static String |
isPassivationCapable(javax.enterprise.context.spi.Contextual<?> contextual) |
boolean |
isPassivationCapableDependency(javax.enterprise.inject.spi.InjectionPoint injectionPoint) |
static boolean |
isStaticInjection(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
Determines if the injection is to be performed into a static field.
|
void |
lazyInitializeManagedBean(Class<?> clazz,
ManagedBean<?> managedBean,
ManagedBeanCreatorImpl<?> managedBeanCreator) |
<T> T |
newInstanceForced(Class<T> clazz)
Create a new instance of the given class using it's default constructor
regardless if the constructor is visible or not.
|
void |
setBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent,
AbstractProducerBean<?> producer,
Annotation[] annotations) |
void |
setInjectionTargetBeanEnableFlag(InjectionTargetBean<?> bean)
Sets bean enabled flag.
|
boolean |
supportsJavaEeComponentInjections(Class<?> clazz)
Returns true if given class supports injections,
false otherwise.
|
static void |
throwRuntimeExceptions(Exception e) |
public WebBeansUtil(WebBeansContext webBeansContext)
public static ClassLoader getCurrentClassLoader()
public static void checkGenericType(javax.enterprise.inject.spi.Bean<?> bean)
bean - managed bean instancepublic static void checkProducerGenericType(javax.enterprise.inject.spi.Bean<?> bean,
Member member)
bean - producer bean instancemember - related member instancepublic void isManagedBeanClass(Class<?> clazz)
true if the given class is ok for manage bean conditions,
false otherwise.clazz - class in handpublic boolean supportsJavaEeComponentInjections(Class<?> clazz)
Each plugin is asked with given class that supports injections or not.
clazz - scanned classpublic <T> Constructor<T> defineConstructor(Class<T> clazz) throws WebBeansConfigurationException
T - type infoclazz - class typeWebBeansConfigurationException - any configuration exceptionpublic <T> Constructor<T> defineConstructor(Constructor<?>[] constructors, Class<T> clazz)
public boolean isConstructureOk(Class<?> clazz) throws WebBeansConfigurationException
clazz - web beans simple classWebBeansConfigurationException - if the web beans has incompatible
constructorpublic static void checkProducerMethodForDeployment(Method method, String parentImplClazzName)
method - producer methodparentImplClazzName - parent class namepublic static void checkProducerMethodDisposal(Method disposalMethod, String definedBeanClassName)
disposalMethod - disposal methoddefinedBeanClassName - bean class namepublic <T> NewManagedBean<T> createNewComponent(Class<T> clazz, Type apiType)
T - clazz - impl. classpublic <T> ExtensionBean<T> createExtensionComponent(Class<T> clazz)
T - extension service classclazz - impl. classpublic BeanManagerBean getManagerBean()
public <T> InstanceBean<T> getInstanceBean()
public <T> EventBean<T> getEventBean()
public ConversationBean getConversationBean()
public InjectionPointBean getInjectionPointBean()
public Method checkCommonAnnotationCriterias(Class<?> clazz, Class<? extends Annotation> commonAnnotation, boolean invocationContext)
PostConstruct or PreDestroy annotated method
criterias, and return post construct or pre destroyDependents method.
Web Beans container is responsible for setting the post construct or pre destroyDependents annotation if the web beans component is not an EJB components, in this case EJB container is responsible for this.
clazz - checked classcommonAnnotation - post construct or predestroy annotationinvocationContext - whether the takes an invocationContext, as in
interceptors defiend outside of the bean class.public <T> Method checkCommonAnnotationCriterias(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType, Class<? extends Annotation> commonAnnotation, boolean invocationContext)
public static Method checkAroundInvokeAnnotationCriterias(Class<?> clazz, Class<? extends Annotation> annot)
AroundInvoke annotated method criterias, and return
around invoke method.
Web Beans container is responsible for setting around invoke annotation if the web beans component is not an EJB components, in this case EJB container is responsible for this.
clazz - checked classpublic static <T> Method checkAroundInvokeAnnotationCriterias(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType, Class<? extends Annotation> annot)
public void configureInterceptorMethods(javax.enterprise.inject.spi.Interceptor<?> webBeansInterceptor,
Class<?> interceptorClass,
Class<? extends Annotation> interceptionType,
boolean definedInInterceptorClass,
boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod,
boolean defineWithInterceptorBinding)
interceptorClass - interceptor classinterceptionType - annotation typedefinedInInterceptorClass - check if annotation is defined in
interceptor class (as opposed to bean class)definedInMethod - check if the interceptor is defined in the comp.
methodstack - interceptor stackannotatedInterceptorClassMethod - if definedInMethod, this specify
methoddefineWithInterceptorBinding - if interceptor is defined with WebBeans
spec, not EJB specpublic <T> void configureInterceptorMethods(javax.enterprise.inject.spi.Interceptor<?> webBeansInterceptor,
javax.enterprise.inject.spi.AnnotatedType<T> annotatedType,
Class<? extends Annotation> annotation,
boolean definedInInterceptorClass,
boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod)
public <T> T newInstanceForced(Class<T> clazz) throws WebBeansConfigurationException
T - clazz - WebBeansConfigurationExceptionpublic static boolean isContainsInterceptorMethod(List<InterceptorData> stack, javax.enterprise.inject.spi.InterceptionType type)
stack - interceptor stacktype - interceptor typeprotected static boolean isDirectlySpecializedBeanSet(Set<javax.enterprise.inject.spi.Bean<?>> beans)
beans, - a set of specialized beans.protected void configureSpecializations(Class<?> specializedClass, List<Class<?>> beanClasses)
Specialized beans inherit the name property
from their parents. Specialized bean deployment priority
must be higher than its super class related bean.
specializedClass - specialized classDefinitionException - if name is definedInconsistentSpecializationException - related with priorityWebBeansConfigurationException - any other exceptionprotected void configSpecializedProducerMethodBeans(List<ProducerMethodBean> sortedProducerBeans)
sortedProducerBeans - public void configureProducerMethodSpecializations()
public Set<javax.enterprise.inject.spi.Bean<?>> isConfiguredWebBeans(Class<?> clazz, boolean annotate)
public void checkUnproxiableApiType(javax.enterprise.inject.spi.Bean<?> bean,
Class<? extends Annotation> scopeType)
bean - managed beanscopeType - scope typeWebBeansConfigurationException - if
bean is not proxied by the containerpublic static void configureProducerSpecialization(AbstractOwbBean<?> component, Method method, Class<?> superClass)
component - producer method componentmethod - specialized producer methodsuperClass - bean super class that has overriden methodDefinitionException - if the name is exist on the producer method when
parent also has nameWebBeansConfigurationException - any other exceptionspublic boolean configuredProducerSpecializedName(AbstractOwbBean<?> component, Method method, Method superMethod)
component - producer method componentmethod - specialized producer methodsuperMethod - overriden super producer methodpublic static void checkInjectedMethodParameterConditions(Method method, Class<?> clazz)
public static boolean checkObtainsInjectionPointConditions(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
injectionPoint - injection point definitionpublic <T> void defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator, javax.enterprise.inject.spi.ProcessInjectionTarget<T> injectionTargetEvent)
public <T> void defineDecorator(ManagedBeanCreatorImpl<T> creator, javax.enterprise.inject.spi.ProcessInjectionTarget<T> processInjectionTargetEvent)
T - type infocreator - bean creatorprocessInjectionTargetEvent - public static void checkNullInstance(Object instance, Class<?> scopeType, String errorMessage, Object... errorMessageArgs)
public void checkSerializableScopeType(Class<? extends Annotation> scopeType, boolean isSerializable, String errorMessage, Object... errorMessageArgs)
public static javax.enterprise.inject.spi.Bean<?> getMostSpecializedBean(javax.enterprise.inject.spi.BeanManager manager,
javax.enterprise.inject.spi.Bean<?> component)
public <T> GProcessAnnotatedType fireProcessAnnotatedTypeEvent(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType)
ProcessAnnotatedType event.T - bean typeannotatedType - bean classpublic <T> GProcessInjectionTarget fireProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
ProcessInjectionTarget event.T - bean typebean - bean instancepublic GProcessInjectionTarget fireProcessInjectionTargetEvent(GProcessInjectionTarget processInjectionTargetEvent)
public <T> GProcessInjectionTarget createProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
public <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
ProcessInjectionTarget event.T - bean typepublic GProcessProducer fireProcessProducerEventForMethod(ProducerMethodBean<?> producerMethod, javax.enterprise.inject.spi.AnnotatedMethod<?> method)
public GProcessProducer fireProcessProducerEventForField(ProducerFieldBean<?> producerField, javax.enterprise.inject.spi.AnnotatedField<?> field)
public void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,javax.enterprise.inject.spi.AnnotatedMethod<?>> annotatedMethods, javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)
public void fireProcessObservableMethodBeanEvent(Map<javax.enterprise.inject.spi.ObserverMethod<?>,javax.enterprise.inject.spi.AnnotatedMethod<?>> annotatedMethods)
public void fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,javax.enterprise.inject.spi.AnnotatedField<?>> annotatedFields)
public static void checkInjectionPointNamedQualifier(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
public void setInjectionTargetBeanEnableFlag(InjectionTargetBean<?> bean)
bean - bean instancepublic static boolean hasInjectionTargetBeanAnnotatedWithAlternative(InjectionTargetBean<?> bean)
public void setBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent, AbstractProducerBean<?> producer, Annotation[] annotations)
public static boolean isExtensionEventType(Class<?> clazz)
public static boolean isExtensionBeanEventType(Class<?> clazz)
public static boolean isDefaultExtensionBeanEventType(Class<?> clazz)
public static boolean isExtensionProducerOrObserverEventType(Class<?> clazz)
public static boolean isDefaultExtensionProducerOrObserverEventType(Class<?> clazz)
public static boolean isDependent(javax.enterprise.inject.spi.Bean<?> bean)
public void inspectErrorStack(String logMessage)
public static String isPassivationCapable(javax.enterprise.context.spi.Contextual<?> contextual)
contextual - the Bean to checkPassivationCapable and enabledpublic <T> ManagedBean<T> defineAbstractDecorator(ManagedBeanCreatorImpl<T> managedBeanCreator, javax.enterprise.inject.spi.ProcessInjectionTarget<T> processInjectionTargetEvent)
public <T> ManagedBean<T> defineManagedBean(ManagedBeanCreatorImpl<T> managedBeanCreator, javax.enterprise.inject.spi.ProcessInjectionTarget<T> processInjectionTargetEvent, boolean allowLazyInit)
public <T> ManagedBean<T> defineManagedBeanWithoutFireEvents(javax.enterprise.inject.spi.AnnotatedType<T> type)
AfterBeanDiscovery.addBean(javax.enterprise.inject.spi.Bean)}public static boolean isStaticInjection(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
injectionPoint - true if the injection is into a static fieldpublic boolean isPassivationCapableDependency(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
public static void throwRuntimeExceptions(Exception e)
public static boolean isAnnotatedTypeDecorator(javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)
annotatedType - annotated typepublic boolean isAnnotatedTypeDecoratorOrInterceptor(javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)
annotatedType - annotated typepublic static boolean isAnnotatedTypeInterceptor(javax.enterprise.inject.spi.AnnotatedType<?> annotatedType)
annotatedType - annotated typepublic <T> ManagedBean<T> defineManagedBean(javax.enterprise.inject.spi.AnnotatedType<T> type)
public void lazyInitializeManagedBean(Class<?> clazz, ManagedBean<?> managedBean, ManagedBeanCreatorImpl<?> managedBeanCreator)
public <T> ManagedBean<T> defineAbstractDecorator(javax.enterprise.inject.spi.AnnotatedType<T> type)
public <T> void defineDecorator(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType)
T - type infoannotatedType - decorator classpublic <T> void defineInterceptor(javax.enterprise.inject.spi.AnnotatedType<T> annotatedType)
public <X> void checkManagedBeanCondition(javax.enterprise.inject.spi.AnnotatedType<X> type)
throws WebBeansConfigurationException
type - implementation classWebBeansConfigurationException - if any configuration exception occursCopyright © 2008-2013 The Apache Software Foundation. All Rights Reserved.