本文整理汇总了Java中javax.enterprise.inject.spi.ProcessInjectionTarget.setInjectionTarget方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessInjectionTarget.setInjectionTarget方法的具体用法?Java ProcessInjectionTarget.setInjectionTarget怎么用?Java ProcessInjectionTarget.setInjectionTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.enterprise.inject.spi.ProcessInjectionTarget
的用法示例。
在下文中一共展示了ProcessInjectionTarget.setInjectionTarget方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializePropertyLoading
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
/**
* Prepares the injection process of properties from a property file.
*
* @param pit
* The actual target of process injection
* @param <T>
* the generic type of the injection target
*/
public <T> void initializePropertyLoading(@Observes final ProcessInjectionTarget<T> pit) throws IOException {
AnnotatedType<T> at = pit.getAnnotatedType();
if (!at.isAnnotationPresent(PropertyFile.class)) {
return;
}
try {
PropertyFile propertyFile = at.getAnnotation(PropertyFile.class);
Properties properties = loadProperties(propertyFile, pit.getAnnotatedType().getJavaClass());
Map<Field, Object> fieldValues = assignPropertiesToFields(at.getFields(), properties);
InjectionTarget<T> wrapped = new PropertyInjectionTarget<T>(fieldValues, pit, pit.getInjectionTarget());
pit.setInjectionTarget(wrapped);
} catch (Exception e) {
pit.addDefinitionError(e);
}
}
示例2: processInjectionTarget
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
@SuppressWarnings("unused")
<T> void processInjectionTarget(@Observes ProcessInjectionTarget<T> pit, BeanManager beanManager) throws Exception {
try (AutoCloseable handle = Performance.accumulate("ConfigurationExtension.processInjectionTarget")) {
if (isApplicable(pit.getAnnotatedType())) {
pit.setInjectionTarget(new ConfigurableInjectionTarget<T>(pit.getInjectionTarget(), this.configurableManager));
}
}
}
示例3: processInjectionTarget
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
/**
* Observer to a CDI lifecycle event to correctly setup the XML backed "injection".
* @param pit CDI lifecycle callback payload
* @param <X> Type of the Injection to observe
*/
<X extends Creature> void processInjectionTarget(@Observes ProcessInjectionTarget<X> pit) {
Class<? extends Creature> klass = pit.getAnnotatedType().getJavaClass();
log.info("Setting up injection target for " + klass);
final Element entry = (Element) document.getElementsByTagName(klass.getSimpleName().toLowerCase()).item(0);
pit.setInjectionTarget(new XmlBackedWrappedInjectionTarget<X>(pit.getInjectionTarget(), entry));
}
示例4: camelContextBeans
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
private <T extends CamelContext> void camelContextBeans(@Observes ProcessInjectionTarget<T> pit, BeanManager manager) {
pit.setInjectionTarget(environment.camelContextInjectionTarget(pit.getInjectionTarget(), pit.getAnnotatedType(), manager, this));
}
示例5: camelBeansPostProcessor
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
private <T> void camelBeansPostProcessor(@Observes ProcessInjectionTarget<T> pit, BeanManager manager) {
if (camelBeans.contains(pit.getAnnotatedType())) {
pit.setInjectionTarget(new CamelBeanInjectionTarget<>(pit.getInjectionTarget(), manager));
}
}
示例6: camelContextAware
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
private <T extends CamelContextAware> void camelContextAware(@Observes ProcessInjectionTarget<T> pit, BeanManager manager) {
pit.setInjectionTarget(new CamelBeanInjectionTarget<>(pit.getInjectionTarget(), manager));
}
示例7: camelContextBeans
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
private <T extends CamelContext> void camelContextBeans(@Observes ProcessInjectionTarget<T> pit, BeanManager manager) {
pit.setInjectionTarget(environment.camelContextInjectionTarget(pit.getInjectionTarget(), pit.getAnnotatedType(), manager));
}
示例8: camelBeansPostProcessor
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
private <T> void camelBeansPostProcessor(@Observes ProcessInjectionTarget<T> pit, BeanManager manager) {
if (camelBeans.contains(pit.getAnnotatedType()))
pit.setInjectionTarget(new CamelBeanInjectionTarget<>(pit.getInjectionTarget(), manager));
}
示例9: processInjectorTarger
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
/**
* Handle all injections
*
* @param pit ProcessInjectionTarget to inspect.
**/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void processInjectorTarger(@Observes ProcessInjectionTarget<Object> pit) {
pit.setInjectionTarget(new RegisterWebSocketEventListenerInjectionTarget(pit.getInjectionTarget(), listenerCandidates, servletConfigs));
}
示例10: onProcessInjectionTarget
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
public <X> void onProcessInjectionTarget(@Observes ProcessInjectionTarget<X> processInjectionTarget,
BeanManager beanManager)
{
if (!isActivated)
{
return;
}
for (MockFilter mockFilter : mockFilters)
{
if (!mockFilter.isMockedImplementationSupported(beanManager, processInjectionTarget.getAnnotatedType()))
{
return;
}
}
List<Annotation> qualifiers = new ArrayList<Annotation>();
for (Annotation annotation : processInjectionTarget.getAnnotatedType().getAnnotations())
{
if (beanManager.isQualifier(annotation.annotationType()))
{
qualifiers.add(annotation);
}
}
Typed typed = processInjectionTarget.getAnnotatedType().getAnnotation(Typed.class);
List<Type> foundTypes = new ArrayList<Type>();
if (typed != null)
{
Collections.addAll(foundTypes, typed.value());
}
else
{
foundTypes.addAll(extractTypes(processInjectionTarget.getAnnotatedType().getJavaClass()));
}
if (foundTypes.isEmpty())
{
return;
}
final InjectionTarget<X> originalInjectionTarget = processInjectionTarget.getInjectionTarget();
processInjectionTarget.setInjectionTarget(new MockAwareInjectionTargetWrapper<X>(
beanManager, originalInjectionTarget, foundTypes, qualifiers));
}
示例11: processInjectionTarget
import javax.enterprise.inject.spi.ProcessInjectionTarget; //导入方法依赖的package包/类
/**
* Processes every available CDI injection target and wires it up with the necessary
* property resolution processing
*
* @param pit
* The injection target being configured
* @param beanManager
* The CDI bean manager
*/
<T> void processInjectionTarget(@Observes ProcessInjectionTarget<T> pit, BeanManager beanManager) {
InjectionTarget<T> it = pit.getInjectionTarget();
AnnotatedType<T> at = pit.getAnnotatedType();
PropertyFormat propertyFormat = PropertyFormatFactory.getInstance();
pit.setInjectionTarget(new PropertyResolverInjectionTarget<T>(it, at, resolverGateway
.getResolver(PropertyResolverBean.class), propertyFormat));
}