|
||||||||||
| 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.
| Method Summary | ||
|---|---|---|
static
|
checkAroundInvokeAnnotationCriterias(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. |
|
static
|
checkCommonAnnotationCriterias(AnnotatedType<T> annotatedType,
Class<? extends Annotation> commonAnnotation,
boolean invocationContext)
|
|
static 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 |
checkDecoratorResolverParams(Set<Type> apiTypes,
Annotation... qualifiers)
|
|
static Annotation[] |
checkForNewQualifierForDeployment(Type type,
Class<?> clazz,
String name,
Annotation[] annotations)
Check conditions for the new binding. |
|
static void |
checkGenericType(Bean<?> bean)
Checks the generic type requirements. |
|
static void |
checkInjectedMethodParameterConditions(Method method,
Class<?> clazz)
|
|
static void |
checkInjectionPointNamedQualifier(InjectionPoint injectionPoint)
|
|
static void |
checkInterceptorResolverParams(Annotation... interceptorBindings)
|
|
static void |
checkNullable(Class<?> type,
AbstractOwbBean<?> component)
|
|
static void |
checkNullInstance(Object instance,
Class<?> scopeType,
String errorMessage)
|
|
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. |
|
static void |
checkProducerMethodDisposal(Method disposalMethod,
String definedBeanClassName)
CheckProducerMethodDisposal. |
|
static void |
checkProducerMethodForDeployment(Method method,
String parentImplClazzName)
Check producer method is ok for deployment. |
|
static void |
checkSerializableScopeType(Class<? extends Annotation> scopeType,
boolean isSerializable,
String errorMessage)
|
|
static void |
checkStereoTypeClass(Class<? extends Annotation> clazz)
Validates that given class obeys stereotype model defined by the specification. |
|
static void |
checkStereoTypeClass(Class<? extends Annotation> clazz,
Annotation... annotations)
Validates that given class obeys stereotype model defined by the specification. |
|
static void |
checkUnproxiableApiType(Bean<?> bean,
Class<? extends Annotation> scopeType)
Checks the unproxiable condition. |
|
protected static 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. |
|
static boolean |
configuredProducerSpecializedName(AbstractOwbBean<?> component,
Method method,
Method superMethod)
Configures the name of the producer method for specializing the parent. |
|
static
|
configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
AnnotatedType<T> annotatedType,
Class<? extends Annotation> annotation,
boolean definedInInterceptorClass,
boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod)
|
|
static void |
configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
Class<?> interceptorClass,
Class<? extends Annotation> interceptorType,
boolean definedInInterceptorClass,
boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod,
boolean defineWithInterceptorBinding)
Configures the interceptor stack of the web beans component. |
|
static void |
configureProducerMethodSpecializations()
Configure direct/indirect specialized producer method beans. |
|
static void |
configureProducerSpecialization(AbstractOwbBean<?> component,
Method method,
Class<?> superClass)
Configures the producer method specialization. |
|
protected static void |
configureSpecializations(Class<?> specializedClass,
List<Class<?>> beanClasses)
Configures the bean specializations. |
|
static void |
configureSpecializations(List<Class<?>> beanClasses)
|
|
static
|
createExtensionComponent(Class<T> clazz)
Creates a new extension bean. |
|
static
|
createNewBean(AbstractInjectionTargetBean<T> bean)
Returns a new managed bean from given bean. |
|
static
|
createNewComponent(Class<T> clazz,
Type apiType)
New WebBeans component class. |
|
static
|
defineAbstractDecorator(ManagedBeanCreatorImpl<T> managedBeanCreator,
ProcessInjectionTarget<T> processInjectionTargetEvent)
|
|
static
|
defineConstructor(Class<T> clazz)
Defines applicable constructor. |
|
static
|
defineConstructor(Constructor<T>[] constructors,
Class<T> clazz)
|
|
static
|
defineDecorator(ManagedBeanCreatorImpl<T> creator,
ProcessInjectionTarget<T> processInjectionTargetEvent)
Define decorator bean. |
|
static
|
defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator,
ProcessInjectionTarget<T> injectionTargetEvent)
|
|
static
|
defineManagedBean(ManagedBeanCreatorImpl<T> managedBeanCreator,
ProcessInjectionTarget<T> processInjectionTargetEvent)
|
|
static
|
defineManagedBeanWithoutFireEvents(AnnotatedType<T> type)
|
|
static
|
fireProcessAnnotatedTypeEvent(AnnotatedType<T> annotatedType)
Returns ProcessAnnotatedType event. |
|
static
|
fireProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
Returns ProcessInjectionTarget event. |
|
static
|
fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
Returns ProcessInjectionTarget event. |
|
static void |
fireProcessObservableMethodBeanEvent(Map<ObserverMethod<?>,AnnotatedMethod<?>> annotatedMethods)
|
|
static GProcessProducer |
fireProcessProducerEventForField(ProducerFieldBean<?> producerField,
AnnotatedField<?> field)
|
|
static GProcessProducer |
fireProcessProducerEventForMethod(ProducerMethodBean<?> producerMethod,
AnnotatedMethod<?> method)
|
|
static void |
fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields)
|
|
static void |
fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods,
AnnotatedType<?> annotatedType)
|
|
static Annotation[] |
getComponentStereoTypes(OwbBean<?> bean)
Returns bean stereotypes. |
|
static ConversationBean |
getConversationBean()
Returns new conversation bean instance. |
|
static ClassLoader |
getCurrentClassLoader()
Gets current classloader with current thread. |
|
static
|
getEventBean()
Creates a new event bean. |
|
static InjectionPointBean |
getInjectionPointBean()
Returns a new injected point bean instance. |
|
static
|
getInstanceBean()
Creates a new instance bean. |
|
static String |
getManagedBeanDefaultName(String clazzName)
|
|
static BeanManagerBean |
getManagerBean()
Creates a new manager bean instance. |
|
static Bean<?> |
getMostSpecializedBean(BeanManager manager,
Bean<?> component)
|
|
static String |
getProducerDefaultName(String methodName)
|
|
static boolean |
hasInjectionTargetBeanAnnotatedWithAlternative(InjectionTargetBean<?> bean)
|
|
static boolean |
hasNamedOnStereoTypes(OwbBean<?> bean)
Returns true if name exists,false otherwise. |
|
static void |
initProxyFactoryClassLoaderProvider()
|
|
static void |
inspectErrorStack(String logMessage)
|
|
static boolean |
isBeanHasEnterpriseMarker(Object beanInstance)
Returns true if bean instance is an enterprise bean instance false otherwise. |
|
static boolean |
isComponentHasStereoType(OwbBean<?> component)
Returns true if array contains the StereoType meta annotation |
|
static Set<Bean<?>> |
isConfiguredWebBeans(Class<?> clazz,
boolean annotate)
|
|
static boolean |
isConstructureOk(Class<?> clazz)
Check that simple web beans class has compatible constructor. |
|
static boolean |
isContainsInterceptorMethod(List<InterceptorData> stack,
InterceptorType type)
Returns true if interceptor stack contains interceptor with given type. |
|
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 |
isEnterpriseBean(AbstractOwbBean<?> bean)
Returns true if bean is an enterprise bean, false otherwise. |
|
static boolean |
isExtensionBeanEventType(Class<?> clazz)
|
|
static boolean |
isExtensionEventType(Class<?> clazz)
|
|
static boolean |
isExtensionProducerOrObserverEventType(Class<?> clazz)
|
|
static boolean |
isManagedBean(AbstractOwbBean<?> component)
|
|
static void |
isManagedBeanClass(Class<?> clazz)
Return true if the given class is ok for manage bean conditions,
false otherwise. |
|
static String |
isPassivationCapable(Contextual<?> contextual)
|
|
static boolean |
isPassivationCapableDependency(InjectionPoint injectionPoint)
|
|
static boolean |
isProducerBean(AbstractOwbBean<?> bean)
|
|
static boolean |
isScopeEncloseOther(Class<? extends Annotation> src,
Class<? extends Annotation> target)
Returns true if src scope encloses the target. |
|
static boolean |
isScopeTypeNormal(Class<? extends Annotation> scopeType)
The result of this invocation get's cached |
|
static boolean |
isStaticInjection(InjectionPoint injectionPoint)
Determines if the injection is to be performed into a static field. |
|
static
|
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. |
|
static void |
setBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent,
AbstractProducerBean<?> producer,
Annotation[] annotations)
|
|
static void |
setInjectionTargetBeanEnableFlag(InjectionTargetBean<?> bean)
Sets bean enabled flag. |
|
static 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 |
| Method Detail |
|---|
public static ClassLoader getCurrentClassLoader()
public static void checkGenericType(Bean<?> bean)
bean - managed bean instance
public static void checkProducerGenericType(Bean<?> bean,
Member member)
bean - producer bean instancemember - related member instancepublic static void isManagedBeanClass(Class<?> clazz)
true if the given class is ok for manage bean conditions,
false otherwise.
clazz - class in handpublic static boolean supportsJavaEeComponentInjections(Class<?> clazz)
Each plugin is asked with given class that supports injections or not.
clazz - scanned class
public static <T> Constructor<T> defineConstructor(Class<T> clazz)
throws WebBeansConfigurationException
T - type infoclazz - class type
WebBeansConfigurationException - any configuration exception
public static <T> Constructor<T> defineConstructor(Constructor<T>[] constructors,
Class<T> clazz)
public static boolean isConstructureOk(Class<?> clazz)
throws WebBeansConfigurationException
clazz - web beans simple class
WebBeansConfigurationException - if the web beans has incompatible
constructor
public static void checkProducerMethodForDeployment(Method method,
String parentImplClazzName)
method - producer methodparentImplClazzName - parent class name
public static void checkProducerMethodDisposal(Method disposalMethod,
String definedBeanClassName)
disposalMethod - disposal methoddefinedBeanClassName - bean class name
public static Annotation[] checkForNewQualifierForDeployment(Type type,
Class<?> clazz,
String name,
Annotation[] annotations)
annotations - annotations
WebBeansConfigurationException - if New plus any other binding annotation is set
public static boolean isScopeEncloseOther(Class<? extends Annotation> src,
Class<? extends Annotation> target)
src - src scopetarget - target scope
public static <T> NewBean<T> createNewComponent(Class<T> clazz,
Type apiType)
T - clazz - impl. class
public static <T> ExtensionBean<T> createExtensionComponent(Class<T> clazz)
T - extension service classclazz - impl. class
public static <T> NewBean<T> createNewBean(AbstractInjectionTargetBean<T> bean)
T - bean type parameterbean - bean instance
public static BeanManagerBean getManagerBean()
public static <T> InstanceBean<T> getInstanceBean()
public static <T> EventBean<T> getEventBean()
public static ConversationBean getConversationBean()
public static InjectionPointBean getInjectionPointBean()
public static 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 static <T> Method checkCommonAnnotationCriterias(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 class
public static <T> Method checkAroundInvokeAnnotationCriterias(AnnotatedType<T> annotatedType,
Class<? extends Annotation> annot)
public static void configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
Class<?> interceptorClass,
Class<? extends Annotation> interceptorType,
boolean definedInInterceptorClass,
boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod,
boolean defineWithInterceptorBinding)
interceptorClass - interceptor classinterceptorType - 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 spec
public static <T> void configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
AnnotatedType<T> annotatedType,
Class<? extends Annotation> annotation,
boolean definedInInterceptorClass,
boolean definedInMethod,
List<InterceptorData> stack,
Method annotatedInterceptorClassMethod)
public static <T> T newInstanceForced(Class<T> clazz)
throws WebBeansConfigurationException
T - clazz -
WebBeansConfigurationException
public static boolean isContainsInterceptorMethod(List<InterceptorData> stack,
InterceptorType type)
stack - interceptor stacktype - interceptor type
public static boolean isComponentHasStereoType(OwbBean<?> component)
public static Annotation[] getComponentStereoTypes(OwbBean<?> bean)
bean - bean instance
public static boolean hasNamedOnStereoTypes(OwbBean<?> bean)
bean - bean instance
public static String getManagedBeanDefaultName(String clazzName)
public static String getProducerDefaultName(String methodName)
public static void checkStereoTypeClass(Class<? extends Annotation> clazz)
clazz - stereotype class
public static void checkStereoTypeClass(Class<? extends Annotation> clazz,
Annotation... annotations)
clazz - stereotype classprotected static boolean isDirectlySpecializedBeanSet(Set<Bean<?>> beans)
beans, - a set of specialized beans.
public static void configureSpecializations(List<Class<?>> beanClasses)
protected static 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 class
DefinitionException - if name is defined
InconsistentSpecializationException - related with priority
WebBeansConfigurationException - any other exceptionprotected static void configSpecializedProducerMethodBeans(List<ProducerMethodBean> sortedProducerBeans)
sortedProducerBeans - public static void configureProducerMethodSpecializations()
public static Set<Bean<?>> isConfiguredWebBeans(Class<?> clazz,
boolean annotate)
public static void checkUnproxiableApiType(Bean<?> bean,
Class<? extends Annotation> scopeType)
bean - managed beanscopeType - scope type
WebBeansConfigurationException - if
bean is not proxied by the container
public static void checkNullable(Class<?> type,
AbstractOwbBean<?> component)
public static void configureProducerSpecialization(AbstractOwbBean<?> component,
Method method,
Class<?> superClass)
component - producer method componentmethod - specialized producer methodsuperClass - bean super class that has overriden method
DefinitionException - if the name is exist on the producer method when
parent also has name
WebBeansConfigurationException - any other exceptions
public static boolean configuredProducerSpecializedName(AbstractOwbBean<?> component,
Method method,
Method superMethod)
component - producer method componentmethod - specialized producer methodsuperMethod - overriden super producer method
public static void checkInjectedMethodParameterConditions(Method method,
Class<?> clazz)
public static void checkInterceptorResolverParams(Annotation... interceptorBindings)
public static void checkDecoratorResolverParams(Set<Type> apiTypes,
Annotation... qualifiers)
public static boolean checkObtainsInjectionPointConditions(InjectionPoint injectionPoint)
injectionPoint - injection point definition
public static <T> void defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator,
ProcessInjectionTarget<T> injectionTargetEvent)
public static <T> void defineDecorator(ManagedBeanCreatorImpl<T> creator,
ProcessInjectionTarget<T> processInjectionTargetEvent)
T - type infocreator - bean creatorprocessInjectionTargetEvent - public static boolean isScopeTypeNormal(Class<? extends Annotation> scopeType)
scopeType -
true if the given scopeType represents a
NormalScoped beanisScopeTypeNormalCache
public static void checkNullInstance(Object instance,
Class<?> scopeType,
String errorMessage)
public static void checkSerializableScopeType(Class<? extends Annotation> scopeType,
boolean isSerializable,
String errorMessage)
public static boolean isManagedBean(AbstractOwbBean<?> component)
public static boolean isProducerBean(AbstractOwbBean<?> bean)
public static boolean isEnterpriseBean(AbstractOwbBean<?> bean)
bean - bean instance
public static Bean<?> getMostSpecializedBean(BeanManager manager,
Bean<?> component)
public static <T> GProcessAnnotatedType fireProcessAnnotatedTypeEvent(AnnotatedType<T> annotatedType)
ProcessAnnotatedType event.
T - bean typeannotatedType - bean class
public static <T> GProcessInjectionTarget fireProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
ProcessInjectionTarget event.
T - bean typebean - bean instance
public static <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
ProcessInjectionTarget event.
T - bean type
public static GProcessProducer fireProcessProducerEventForMethod(ProducerMethodBean<?> producerMethod,
AnnotatedMethod<?> method)
public static GProcessProducer fireProcessProducerEventForField(ProducerFieldBean<?> producerField,
AnnotatedField<?> field)
public static void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods,
AnnotatedType<?> annotatedType)
public static void fireProcessObservableMethodBeanEvent(Map<ObserverMethod<?>,AnnotatedMethod<?>> annotatedMethods)
public static void fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields)
public static boolean isBeanHasEnterpriseMarker(Object beanInstance)
beanInstance - bean instance
public static void checkInjectionPointNamedQualifier(InjectionPoint injectionPoint)
public static void setInjectionTargetBeanEnableFlag(InjectionTargetBean<?> bean)
bean - bean instancepublic static boolean hasInjectionTargetBeanAnnotatedWithAlternative(InjectionTargetBean<?> bean)
public static 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(Bean<?> bean)
public static void inspectErrorStack(String logMessage)
public static String isPassivationCapable(Contextual<?> contextual)
contextual - the Bean to check
PassivationCapable and enabled
public static <T> ManagedBean<T> defineAbstractDecorator(ManagedBeanCreatorImpl<T> managedBeanCreator,
ProcessInjectionTarget<T> processInjectionTargetEvent)
public static <T> ManagedBean<T> defineManagedBean(ManagedBeanCreatorImpl<T> managedBeanCreator,
ProcessInjectionTarget<T> processInjectionTargetEvent)
public static <T> ManagedBean<T> defineManagedBeanWithoutFireEvents(AnnotatedType<T> type)
public static boolean isStaticInjection(InjectionPoint injectionPoint)
injectionPoint -
true if the injection is into a static fieldpublic static boolean isPassivationCapableDependency(InjectionPoint injectionPoint)
public static void throwRuntimeExceptions(Exception e)
public static void initProxyFactoryClassLoaderProvider()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||