java.lang.Object
com.sun.faces.cdi.CdiUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAnnotatedTypes
(BeforeBeanDiscovery beforeBean, BeanManager beanManager, Class<?>... types) static Behavior
createBehavior
(BeanManager beanManager, String value) Create a behavior using the FacesBehavior value attribute.static Converter
<?> createConverter
(BeanManager beanManager, Class<?> forClass) Create a converter using the FacesConverter forClass attribute.static Converter
<?> createConverter
(BeanManager beanManager, String value) Create a converter using the FacesConverter value attribute.static DataModel
<?> createDataModel
(Class<?> forClass) static Validator
<?> createValidator
(BeanManager beanManager, String value) Create a validator using the FacesValidator value attribute.static <A extends Annotation>
Optional<A> getAnnotation
(BeanManager beanManager, Annotated annotated, Class<A> annotationType) Finds an annotation in an Annotated, taking stereo types into accountstatic <T> T
getBeanInstance
(Class<T> type, boolean create) Returns concrete (non-proxied) bean instance of given class in current context.static <T> T
getBeanReference
(BeanManager beanManager, Class<T> type, Annotation... qualifiers) static <T> T
getBeanReference
(FacesContext facesContext, Class<T> type, Annotation... qualifiers) static <T> T
getBeanReference
(Class<T> type, Annotation... qualifiers) static Object
getBeanReferenceByType
(BeanManager beanManager, Type type, Annotation... qualifiers) static InjectionPoint
getCurrentInjectionPoint
(BeanManager beanManager, CreationalContext<?> creationalContext) Returns the current injection point.getDataModelClassesMap
(CDI<Object> cdi) static <A extends Annotation>
AgetQualifier
(InjectionPoint injectionPoint, Class<A> qualifierClass) Returns the qualifier annotation of the given qualifier class from the given injection point.static <S extends Annotation>
booleanisScopeActive
(Class<S> scope) Returns true if given scope is active in current context.
-
Method Details
-
createConverter
Create a converter using the FacesConverter value attribute.- Parameters:
beanManager
- the bean manager.value
- the value attribute.- Returns:
- the converter, or null if we could not match one.
-
createConverter
Create a converter using the FacesConverter forClass attribute.- Parameters:
beanManager
- the bean manager.forClass
- the for class.- Returns:
- the converter, or null if we could not match one.
-
createBehavior
Create a behavior using the FacesBehavior value attribute.- Parameters:
beanManager
- the bean manager.value
- the value attribute.- Returns:
- the behavior, or null if we could not match one.
-
createValidator
Create a validator using the FacesValidator value attribute.- Parameters:
beanManager
- the bean manager.value
- the value attribute.- Returns:
- the validator, or null if we could not match one.
-
addAnnotatedTypes
public static void addAnnotatedTypes(BeforeBeanDiscovery beforeBean, BeanManager beanManager, Class<?>... types) -
getBeanReference
-
getBeanReference
public static <T> T getBeanReference(FacesContext facesContext, Class<T> type, Annotation... qualifiers) -
getBeanReference
public static <T> T getBeanReference(BeanManager beanManager, Class<T> type, Annotation... qualifiers) - Type Parameters:
T
- the generic bean type- Parameters:
beanManager
- the bean managertype
- the required bean type the reference must havequalifiers
- the required qualifiers the reference must have- Returns:
- a bean reference adhering to the required type and qualifiers
-
getBeanReferenceByType
public static Object getBeanReferenceByType(BeanManager beanManager, Type type, Annotation... qualifiers) -
getBeanInstance
Returns concrete (non-proxied) bean instance of given class in current context.- Type Parameters:
T
- the generic bean type- Parameters:
type
- the required bean type the instance must havecreate
- whether to auto-create bean if not exist- Returns:
- a bean instance adhering to the required type
-
getAnnotation
public static <A extends Annotation> Optional<A> getAnnotation(BeanManager beanManager, Annotated annotated, Class<A> annotationType) Finds an annotation in an Annotated, taking stereo types into account- Type Parameters:
A
- the generic annotation type- Parameters:
beanManager
- the current bean managerannotated
- the Annotated in which to searchannotationType
- the type of the annotation to search for- Returns:
- An Optional that contains an instance of annotation type for which was searched if the annotated contained this.
-
createDataModel
-
getDataModelClassesMap
-
getCurrentInjectionPoint
public static InjectionPoint getCurrentInjectionPoint(BeanManager beanManager, CreationalContext<?> creationalContext) Returns the current injection point.- Parameters:
beanManager
- the involved bean managercreationalContext
- the involved creational context- Returns:
- the current injection point
-
getQualifier
public static <A extends Annotation> A getQualifier(InjectionPoint injectionPoint, Class<A> qualifierClass) Returns the qualifier annotation of the given qualifier class from the given injection point.- Type Parameters:
A
- the type of given qualifier class- Parameters:
injectionPoint
- the injection pointqualifierClass
- the qualifier class to be filtered- Returns:
- the qualifier annotation
-
isScopeActive
Returns true if given scope is active in current context.- Type Parameters:
S
- the type of given scope- Parameters:
scope
- the scope to be checked- Returns:
- whether given scope is active
-