@Typed public abstract class CodiUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
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 <T> T |
getContextualReference(javax.enterprise.inject.spi.BeanManager beanManager,
Type t,
javax.enterprise.inject.spi.Bean<T> bean)
Creates a scoped instance (a proxy for normal scoped beans) for the given bean-descriptor.
|
static <T> T |
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 <T> T |
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 <T> T |
getContextualReferenceByClass(Class<T> targetClass,
Annotation... qualifier)
Creates a scoped instance (a proxy for normal scoped beans) for the given bean-class and qualifiers
|
static <T> T |
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 <T> T |
getContextualReferenceByName(javax.enterprise.inject.spi.BeanManager beanManager,
String beanName,
boolean optionalBeanAllowed,
Class<T> targetClass)
Creates a scoped instance (a proxy for normal scoped beans) for the given bean-name and class
|
static <T> T |
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 <T> T |
injectFields(T instance)
Allows to perform dependency injection for instances which aren't managed by CDI
|
static <T> T |
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 <T extends Serializable> |
lookupConfigFromEnvironment(String key,
Class<T> targetType,
T defaultValue)
Resolves the configured value for the given key or uses the caller method-name as naming-convention,
if no key is provided.
|
static <T extends Serializable> |
lookupFromEnvironment(Class<T> targetType,
Aggregatable<T> aggregatable,
T... defaultImplementation)
Resolves resources outside of CDI for the given class.
|
static <T extends Serializable> |
lookupFromEnvironment(Class<T> targetType,
T... defaultImplementation)
Resolves resources outside of CDI for the given class.
|
static <T extends Serializable> |
lookupFromEnvironment(String key,
Class<T> targetType,
Aggregatable<T> aggregatable,
T... defaultImplementation)
Resolves resources outside of CDI for the given key and class.
|
static <T extends Serializable> |
lookupFromEnvironment(String key,
Class<T> targetType,
T... defaultImplementation)
Resolves resources outside of CDI for the given key and class.
|
public static <T> T createNewInstanceOfBean(javax.enterprise.context.spi.CreationalContext<T> creationalContext,
javax.enterprise.inject.spi.Bean<T> bean)
Bean and CreationalContextT - current typecreationalContext - current contextbean - current beanpublic 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 beanpublic static <T> T getContextualReferenceByName(javax.enterprise.inject.spi.BeanManager beanManager,
String beanName,
boolean optionalBeanAllowed,
Class<T> targetClass)
T - target typebeanManager - current bean-managerbeanName - name of the beanoptionalBeanAllowed - flag which indicates if it's an optional beantargetClass - class of the beanpublic static <T> T getContextualReferenceByClass(Class<T> targetClass, Annotation... qualifier)
T - target typetargetClass - class of the beanqualifier - optional qualifierspublic 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 qualifierspublic 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 qualifierspublic 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 qualifierspublic static <T> T getContextualReference(javax.enterprise.inject.spi.BeanManager beanManager,
Type t,
javax.enterprise.inject.spi.Bean<T> bean)
T - target typebeanManager - current bean-managert - type of the beanbean - bean-descriptorpublic static <T> T injectFields(T instance)
T - current typeinstance - current instancepublic 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 qualifierpublic static <T extends Serializable> T lookupFromEnvironment(Class<T> targetType, T... defaultImplementation)
T - current typetargetType - target typedefaultImplementation - default implementationpublic static <T extends Serializable> T lookupFromEnvironment(Class<T> targetType, Aggregatable<T> aggregatable, T... defaultImplementation)
T - current typetargetType - target type which is also used as key (the simple name of it)aggregatable - allows to aggregate multiple resultsdefaultImplementation - default implementationpublic static <T extends Serializable> T lookupFromEnvironment(String key, Class<T> targetType, T... defaultImplementation)
T - current typekey - key for identifying the resource which has to be resolvedtargetType - target typedefaultImplementation - default implementationpublic static <T extends Serializable> T lookupConfigFromEnvironment(String key, Class<T> targetType, T defaultValue)
T - current typekey - optional key for the value in questiontargetType - type of the configured value - supported: string, boolean, integerdefaultValue - the default value which will be returned if no configured value can be foundpublic static <T extends Serializable> T lookupFromEnvironment(String key, Class<T> targetType, Aggregatable<T> aggregatable, T... defaultImplementation)
T - current typekey - key for identifying the resource which has to be resolvedtargetType - target typeaggregatable - allows to aggregate multiple resultsdefaultImplementation - default implementationpublic static boolean isCdiInitialized()
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.