|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.webbeans.util.WebBeansUtil
public final class WebBeansUtil
Contains some utility methods used in the all project.
| Constructor Summary | |
|---|---|
WebBeansUtil(WebBeansContext webBeansContext)
|
|
| Method Summary | ||
|---|---|---|
static void |
checkGenericType(Class<?> clazz,
Class<? extends Annotation> scope)
Checks the generic type requirements. |
|
static void |
checkInjectionPointNamedQualifier(InjectionPoint injectionPoint)
|
|
void |
checkManagedBean(Class<?> clazz)
Returns true if this class can be candidate for simple web bean, false otherwise. |
|
|
checkManagedBeanCondition(AnnotatedType<X> type)
Checks the implementation class for checking conditions. |
|
void |
checkManagedBeanCondition(Class<?> clazz)
|
|
static void |
checkNullInstance(Object instance,
Class<?> scopeType,
String errorMessage,
Object... errorMessageArgs)
|
|
static boolean |
checkObtainsInjectionPointConditions(InjectionPoint injectionPoint)
Returns true if instance injection point false otherwise. |
|
static void |
checkProducerGenericType(Bean<?> bean,
Member member)
Check producer method/field bean return type. |
|
void |
checkSerializableScopeType(Class<? extends Annotation> scopeType,
boolean isSerializable,
String errorMessage,
Object... errorMessageArgs)
|
|
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. |
|
void |
configureProducerMethodSpecializations()
Configure direct/indirect specialized producer method beans. |
|
protected void |
configureSpecializations(Class<?> specializedClass,
List<Class<?>> beanClasses)
Configures the bean specializations. |
|
void |
configureSpecializations(List<Class<?>> beanClasses)
|
|
|
createExtensionComponent(Class<T> clazz)
Creates a new extension bean. |
|
|
createNewComponent(Class<T> type)
|
|
|
createNewComponent(OwbBean<T> bean,
Class<T> type)
New WebBeans component class. |
|
|
defineManagedBean(AnnotatedType<T> type)
|
|
|
defineManagedBeanWithoutFireEvents(AnnotatedType<T> type)
This method will be used in AfterBeanDiscovery.addBean(javax.enterprise.inject.spi.Bean)} |
|
|
fireProcessAnnotatedTypeEvent(AnnotatedType<T> annotatedType)
Returns ProcessAnnotatedType event. |
|
|
fireProcessInjectionTargetEvent(InjectionTargetImpl<T> injectionTarget,
AnnotatedType<T> annotatedType)
Returns ProcessInjectionTarget event. |
|
|
fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
Returns ProcessInjectionTarget event. |
|
void |
fireProcessObservableMethodBeanEvent(Map<ObserverMethod<?>,AnnotatedMethod<?>> annotatedMethods)
|
|
|
fireProcessProducerEvent(Producer<T> producer,
AnnotatedMember<?> annotatedMember)
|
|
void |
fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields)
|
|
void |
fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods,
AnnotatedType<?> annotatedType)
|
|
|
getBeanMetadataBean()
Creates a new bean metadata bean. |
|
ConversationBean |
getConversationBean()
Returns new conversation bean instance. |
|
static ClassLoader |
getCurrentClassLoader()
Gets current classloader with current thread. |
|
|
getDecoratorMetadataBean()
Creates a new decorator metadata bean. |
|
|
getEventBean()
Creates a new event bean. |
|
InjectionPointBean |
getInjectionPointBean()
Returns a new injected point bean instance. |
|
|
getInstanceBean()
Creates a new instance bean. |
|
|
getInterceptedOrDecoratedBeanMetadataBean()
Creates a new metadata bean. |
|
|
getInterceptorMetadataBean()
Creates a new interceptor metadata bean. |
|
static String |
getManagedBeanDefaultName(String clazzName)
|
|
BeanManagerBean |
getManagerBean()
Creates a new manager bean instance. |
|
static Bean<?> |
getMostSpecializedBean(BeanManager manager,
Bean<?> component)
|
|
|
getNoArgConstructor(Class<T> clazz)
|
|
static String |
getPassivationId(Contextual<?> contextual)
|
|
static String |
getProducerDefaultName(String methodName)
|
|
static boolean |
hasInjectionTargetBeanAnnotatedWithAlternative(AnnotatedType<?> beanType,
Set<Class<? extends Annotation>> stereotypes)
|
|
static boolean |
hasInjectionTargetBeanAnnotatedWithAlternative(InjectionTargetBean<?> bean)
|
|
void |
inspectErrorStack(String logMessage)
|
|
boolean |
isAnnotatedTypeDecoratorOrInterceptor(AnnotatedType<?> annotatedType)
Return true if this annotated type represents a decorator. |
|
boolean |
isBeanEnabled(AnnotatedType<?> at,
Set<Class<? extends Annotation>> stereotypes)
|
|
static boolean |
isCdiInterceptor(AnnotatedType<?> annotatedType)
|
|
Set<Bean<?>> |
isConfiguredWebBeans(Class<?> clazz,
boolean annotate)
|
|
boolean |
isConstructorOk(Class<?> clazz)
Check that simple web beans class has compatible constructor. |
|
static boolean |
isDecorator(AnnotatedType<?> annotatedType)
|
|
static boolean |
isDefaultExtensionBeanEventType(Class<?> clazz)
|
|
static boolean |
isDefaultExtensionProducerOrObserverEventType(Class<?> clazz)
|
|
static boolean |
isDependent(Bean<?> bean)
|
|
protected static boolean |
isDirectlySpecializedBeanSet(Set<Bean<?>> beans)
Return true if a list of beans are directly specialized/extended each other. |
|
static boolean |
isExtensionBeanEventType(Type type)
|
|
static boolean |
isExtensionEventType(Type type)
|
|
static boolean |
isExtensionProducerOrObserverEventType(Type type)
|
|
boolean |
isPassivationCapableDependency(InjectionPoint injectionPoint)
|
|
boolean |
isProducerBeanEnabled(InjectionTargetBean<?> parent,
Set<Class<? extends Annotation>> stereotypes,
Annotation[] annotations)
|
|
boolean |
isSuperMethodNamed(AbstractOwbBean<?> component,
Method method,
Method superMethod)
Configures the name of the producer method for specializing the parent. |
|
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)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WebBeansUtil(WebBeansContext webBeansContext)
| Method Detail |
|---|
public static ClassLoader getCurrentClassLoader()
public static void checkGenericType(Class<?> clazz,
Class<? extends Annotation> scope)
public static void checkProducerGenericType(Bean<?> bean,
Member member)
bean - producer bean instancemember - related member instancepublic void checkManagedBean(Class<?> clazz)
clazz - implementation class
WebBeansConfigurationException - if any configuration exception occurs
public void checkManagedBeanCondition(Class<?> clazz)
throws WebBeansConfigurationException
WebBeansConfigurationExceptionpublic boolean supportsJavaEeComponentInjections(Class<?> clazz)
Each plugin is asked with given class that supports injections or not.
clazz - scanned class
public boolean isConstructorOk(Class<?> clazz)
throws WebBeansConfigurationException
clazz - web beans simple class
WebBeansConfigurationException - if the web beans has incompatible
constructorpublic <T> Bean<T> createNewComponent(Class<T> type)
public <T> NewManagedBean<T> createNewComponent(OwbBean<T> bean,
Class<T> type)
public <T> ExtensionBean<T> createExtensionComponent(Class<T> clazz)
T - extension service classclazz - impl. class
public BeanManagerBean getManagerBean()
public <T> InstanceBean<T> getInstanceBean()
public <T> EventBean<T> getEventBean()
public <T> BeanMetadataBean<T> getBeanMetadataBean()
public <T> InterceptorMetadataBean<T> getInterceptorMetadataBean()
public <T> DecoratorMetadataBean<T> getDecoratorMetadataBean()
public <T> InterceptedOrDecoratedBeanMetadataBean<T> getInterceptedOrDecoratedBeanMetadataBean()
public ConversationBean getConversationBean()
public InjectionPointBean getInjectionPointBean()
public static String getManagedBeanDefaultName(String clazzName)
public static String getProducerDefaultName(String methodName)
protected static boolean isDirectlySpecializedBeanSet(Set<Bean<?>> beans)
beans, - a set of specialized beans.
public void configureSpecializations(List<Class<?>> beanClasses)
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.
from the spec:
"If Y has a name and X declares a name explicitly, using @Named,
the container automatically detects the problem and treats it as a definition error.
specializedClass - specialized classbeanClasses - all Classes which are either @Specializes or specialized.
DefinitionException - if name is defined
InconsistentSpecializationException - related with priority
WebBeansConfigurationException - any other exceptionprotected void configSpecializedProducerMethodBeans(List<ProducerMethodBean> sortedProducerBeans)
sortedProducerBeans - public void configureProducerMethodSpecializations()
public Set<Bean<?>> isConfiguredWebBeans(Class<?> clazz,
boolean annotate)
public <T> Constructor<T> getNoArgConstructor(Class<T> clazz)
public boolean isSuperMethodNamed(AbstractOwbBean<?> component,
Method method,
Method superMethod)
component - producer method componentmethod - specialized producer methodsuperMethod - overriden super producer methodpublic static boolean checkObtainsInjectionPointConditions(InjectionPoint injectionPoint)
injectionPoint - injection point definition
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 Bean<?> getMostSpecializedBean(BeanManager manager,
Bean<?> component)
public <T> GProcessAnnotatedType fireProcessAnnotatedTypeEvent(AnnotatedType<T> annotatedType)
ProcessAnnotatedType event.
T - bean typeannotatedType - bean class
public <T> GProcessInjectionTarget fireProcessInjectionTargetEvent(InjectionTargetImpl<T> injectionTarget,
AnnotatedType<T> annotatedType)
ProcessInjectionTarget event.
T - bean type
public <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
ProcessInjectionTarget event.
T - bean type
public <T> Producer<T> fireProcessProducerEvent(Producer<T> producer,
AnnotatedMember<?> annotatedMember)
public void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods,
AnnotatedType<?> annotatedType)
public void fireProcessObservableMethodBeanEvent(Map<ObserverMethod<?>,AnnotatedMethod<?>> annotatedMethods)
public void fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields)
public static void checkInjectionPointNamedQualifier(InjectionPoint injectionPoint)
public void setInjectionTargetBeanEnableFlag(InjectionTargetBean<?> bean)
bean - bean instance
public boolean isBeanEnabled(AnnotatedType<?> at,
Set<Class<? extends Annotation>> stereotypes)
public static boolean hasInjectionTargetBeanAnnotatedWithAlternative(InjectionTargetBean<?> bean)
public static boolean hasInjectionTargetBeanAnnotatedWithAlternative(AnnotatedType<?> beanType,
Set<Class<? extends Annotation>> stereotypes)
public void setBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent,
AbstractProducerBean<?> producer,
Annotation[] annotations)
public boolean isProducerBeanEnabled(InjectionTargetBean<?> parent,
Set<Class<? extends Annotation>> stereotypes,
Annotation[] annotations)
public static boolean isExtensionEventType(Type type)
public static boolean isExtensionBeanEventType(Type type)
public static boolean isDefaultExtensionBeanEventType(Class<?> clazz)
public static boolean isExtensionProducerOrObserverEventType(Type type)
public static boolean isDefaultExtensionProducerOrObserverEventType(Class<?> clazz)
public static boolean isDependent(Bean<?> bean)
public void inspectErrorStack(String logMessage)
public static String getPassivationId(Contextual<?> contextual)
contextual - the Bean to check
PassivationCapable and enabledpublic <T> ManagedBean<T> defineManagedBeanWithoutFireEvents(AnnotatedType<T> type)
AfterBeanDiscovery.addBean(javax.enterprise.inject.spi.Bean)}
public boolean isPassivationCapableDependency(InjectionPoint injectionPoint)
public static void throwRuntimeExceptions(Exception e)
public static boolean isDecorator(AnnotatedType<?> annotatedType)
true if this annotated type represents a decorator.public boolean isAnnotatedTypeDecoratorOrInterceptor(AnnotatedType<?> annotatedType)
annotatedType - annotated type
public static boolean isCdiInterceptor(AnnotatedType<?> annotatedType)
true if this AnnotatedType represents a CDI Interceptor
defined via a Interceptor annotationpublic <T> ManagedBean<T> defineManagedBean(AnnotatedType<T> type)
public <X> void checkManagedBeanCondition(AnnotatedType<X> type)
throws WebBeansConfigurationException
type - implementation class
WebBeansConfigurationException - if any configuration exception occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||