|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.extensions.cdi.core.impl.util.CodiUtils
@Typed public abstract class CodiUtils
This is a collection of a few useful static helper functions.
Method Summary | ||
---|---|---|
static
|
createNewInstanceOfBean(javax.enterprise.context.spi.CreationalContext<T> creationalContext,
javax.enterprise.inject.spi.Bean<T> bean)
Creates an instance for the given Bean and CreationalContext |
|
static
|
getContextualReferenceByClass(javax.enterprise.inject.spi.BeanManager beanManager,
Class<T> targetClass,
Annotation... qualifier)
Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers |
|
static
|
getContextualReferenceByClass(javax.enterprise.inject.spi.BeanManager beanManager,
Class<T> targetClass,
boolean optionalBeanAllowed,
Annotation... qualifier)
Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers. |
|
static
|
getContextualReferenceByClass(Class<T> targetClass,
Annotation... qualifier)
Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers |
|
static
|
getContextualReferenceByClass(Class<T> targetClass,
boolean optionalBeanAllowed,
Annotation... qualifier)
Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers. |
|
static
|
getContextualReferenceByName(javax.enterprise.inject.spi.BeanManager beanManager,
String beanName,
Class<T> targetClass)
Creates a scoped instance (a proxy for normal scoped beans) for the given bean-name and class |
|
static
|
injectFields(T instance)
Allows to perform dependency injection for instances which aren't managed by CDI |
|
static
|
injectFields(T instance,
boolean requiresAdvancedQualifier)
Allows to perform dependency injection for instances which aren't managed by CDI |
|
static boolean |
isCdiInitialized()
Checks if CDI is up and running |
|
static boolean |
isQualifierEqual(Annotation qualifier1,
Annotation qualifier2)
Checks if the given qualifiers are equal. |
|
static
|
lookupFromEnvironment(Class<T> targetType)
Resolves resources outside of CDI for the given class. |
|
static
|
lookupFromEnvironment(Class<T> targetType,
Aggregatable<T> aggregatable)
Resolves resources outside of CDI for the given class. |
|
static
|
lookupFromEnvironment(String key,
Class<T> targetType)
Resolves resources outside of CDI for the given key and class. |
|
static
|
lookupFromEnvironment(String key,
Class<T> targetType,
Aggregatable<T> aggregatable)
Resolves resources outside of CDI for the given key and class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T createNewInstanceOfBean(javax.enterprise.context.spi.CreationalContext<T> creationalContext, javax.enterprise.inject.spi.Bean<T> bean)
Bean
and CreationalContext
T
- current typecreationalContext
- current contextbean
- current bean
public static <T> T getContextualReferenceByName(javax.enterprise.inject.spi.BeanManager beanManager, String beanName, Class<T> targetClass)
T
- target typebeanManager
- current bean-managerbeanName
- name of the beantargetClass
- class of the bean
public static <T> T getContextualReferenceByClass(Class<T> targetClass, Annotation... qualifier)
T
- target typetargetClass
- class of the beanqualifier
- optional qualifiers
public static <T> T getContextualReferenceByClass(javax.enterprise.inject.spi.BeanManager beanManager, Class<T> targetClass, Annotation... qualifier)
T
- target typebeanManager
- current bean-managertargetClass
- class of the beanqualifier
- optional qualifiers
public static <T> T getContextualReferenceByClass(Class<T> targetClass, boolean optionalBeanAllowed, Annotation... qualifier)
T
- target typetargetClass
- class of the beanoptionalBeanAllowed
- flag which indicates if it's an optional beanqualifier
- optional qualifiers
public static <T> T getContextualReferenceByClass(javax.enterprise.inject.spi.BeanManager beanManager, Class<T> targetClass, boolean optionalBeanAllowed, Annotation... qualifier)
T
- target typebeanManager
- current bean-managertargetClass
- class of the beanoptionalBeanAllowed
- flag which indicates if it's an optional beanqualifier
- optional qualifiers
public static <T> T injectFields(T instance)
T
- current typeinstance
- current instance
public static <T> T injectFields(T instance, boolean requiresAdvancedQualifier)
T
- current typeinstance
- current instancerequiresAdvancedQualifier
- flag which indicates if an instance has to be annotated with Advanced
to be eligible for dependency injection.
public static boolean isQualifierEqual(Annotation qualifier1, Annotation qualifier2)
qualifier1
- first qualifierqualifier2
- second qualifier
public static <T extends Serializable> T lookupFromEnvironment(Class<T> targetType)
T
- current typetargetType
- target type
public static <T extends Serializable> T lookupFromEnvironment(Class<T> targetType, Aggregatable<T> aggregatable)
T
- current typetargetType
- target type which is also used as key (the simple name of it)aggregatable
- allows to aggregate multiple results
public static <T extends Serializable> T lookupFromEnvironment(String key, Class<T> targetType)
T
- current typekey
- key for identifying the resource which has to be resolvedtargetType
- target type
public static <T extends Serializable> T lookupFromEnvironment(String key, Class<T> targetType, Aggregatable<T> aggregatable)
T
- current typekey
- key for identifying the resource which has to be resolvedtargetType
- target typeaggregatable
- allows to aggregate multiple results
public static boolean isCdiInitialized()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |