本文整理汇总了Java中javax.enterprise.inject.spi.Producer类的典型用法代码示例。如果您正苦于以下问题:Java Producer类的具体用法?Java Producer怎么用?Java Producer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Producer类属于javax.enterprise.inject.spi包,在下文中一共展示了Producer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: factory
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
private <T> ProducerFactory<T> factory(final Object mock) {
return new ProducerFactory<T>() {
@Override
public <T1> Producer<T1> createProducer(final Bean<T1> bean) {
return new Producer<T1>() {
@Override
public T1 produce(final CreationalContext<T1> ctx) {
return (T1) mock;
}
@Override
public void dispose(final T1 instance) {
}
@Override
public Set<InjectionPoint> getInjectionPoints() {
return Collections.emptySet();
}
};
}
};
}
示例2: testProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
@Test
public void testProducer() {
logger.info("starting producer spi test");
CDI<Object> cdi = current();
BeanManager beanManager = cdi.select(BeanManager.class).get();
AnnotatedField<? super AnotherFactory> field = this
.<AnotherFactory, AnnotatedField<AnotherFactory>>getAnnotatedMember(AnotherFactory.class, "jessie",
beanManager);
Bean<AnotherFactory> declaringBean = cast(beanManager.resolve(beanManager.getBeans(AnotherFactory.class)));
ProducerFactory<AnotherFactory> producerFactory = beanManager.getProducerFactory(field, declaringBean);
Producer<Toy> producer = cast(producerFactory.createProducer(null));
assertNotNull(producer);
assertTrue(producer.getInjectionPoints().isEmpty());
Toy jessie = producer.produce(beanManager.<Toy>createCreationalContext(null));
assertEquals("Jessie", jessie.getName());
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:18,代码来源:InjectSPITestCase.java
示例3: testRegisterProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
@Test
public void testRegisterProducer() {
// GIVEN
final JpaUnitCdiExtension extension = new JpaUnitCdiExtension();
// WHEN
extension.registerProducer(producer);
// THEN
verify(producer).getProducer();
verify(producer).setProducer(producerCaptor.capture());
verifyNoMoreInteractions(producer);
final Producer<EntityManager> captured = producerCaptor.getValue();
assertThat(captured, not(nullValue()));
assertThat(captured, instanceOf(EntityManagerProducerProxy.class));
}
示例4: processCommandBusProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
<T, X extends CommandBus> void processCommandBusProducer(
@Observes final ProcessProducer<T, X> processProducer,
final BeanManager beanManager) {
AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
Producer<X> originalProducer = processProducer.getProducer();
Producer<X> producer = new AutoConfiguringCommandBusProducer<>(originalProducer,
annotatedMember, getAggregateRoots(), getCommandHandlers(), beanManager);
processProducer.setProducer(producer);
}
}
示例5: processEventStoreProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
<T, X extends EventStore> void processEventStoreProducer(
@Observes final ProcessProducer<T, X> processProducer,
final BeanManager beanManager) {
AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
Producer<X> originalProducer = processProducer.getProducer();
Producer<X> producer = new AutoConfiguringEventStoreProducer<>(originalProducer,
annotatedMember,
getEventHandlers(),
getSagas(), beanManager);
processProducer.setProducer(producer);
}
}
示例6: processSnapshotterProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
<T, X extends Snapshotter> void processSnapshotterProducer(
@Observes final ProcessProducer<T, X> processProducer,
final BeanManager beanManager) {
Producer<X> originalProducer = processProducer.getProducer();
AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
Producer<X> producer = new AutoConfiguringAggregateSnapshotterProducer<>(originalProducer,
annotatedMember, getAggregateRoots(), beanManager);
processProducer.setProducer(producer);
}
}
示例7: processSagaRepositoryProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
<T, X extends SagaRepository<?>> void processSagaRepositoryProducer(
@Observes final ProcessProducer<T, X> processProducer,
final BeanManager beanManager) {
Producer<X> originalProducer = processProducer.getProducer();
AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
Producer<X> producer = new AutoConfiguringSagaRepositoryProducer<>(originalProducer,
annotatedMember, beanManager);
processProducer.setProducer(producer);
}
}
示例8: AbstractAutoConfiguringProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
public AbstractAutoConfiguringProducer(final Producer<X> wrappedProducer,
final AnnotatedMember<?> annotatedMember,
final BeanManager beanManager) {
this.wrappedProducer = wrappedProducer;
this.beanManager = beanManager;
this.annotatedMember = annotatedMember;
}
示例9: AutoConfiguringEventStoreProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
public AutoConfiguringEventStoreProducer(final Producer<X> wrappedProducer,
final AnnotatedMember<?> annotatedMember,
final Set<HandlerInfo> eventHandlersInfo,
final Set<SagaInfo> sagasInfo,
final BeanManager beanManager) {
super(wrappedProducer, annotatedMember, beanManager);
this.eventHandlersInfo = eventHandlersInfo;
this.sagaManagersInfo = SagaManagerInfo.from(sagasInfo);
}
示例10: AutoConfiguringCommandBusProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
public AutoConfiguringCommandBusProducer(Producer<X> wrappedProducer,
AnnotatedMember<?> annotatedMember,
Set<AggregateRootInfo> aggregateRootsInfo,
Set<HandlerInfo> commandHandlersInfo,
BeanManager beanManager) {
super(wrappedProducer, annotatedMember, beanManager);
this.commandHandlersInfo = commandHandlersInfo;
this.aggregateRootsInfo = aggregateRootsInfo;
}
示例11: MockAwareProducerWrapper
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
public MockAwareProducerWrapper(BeanManager beanManager,
Producer<T> wrapped,
List<Type> beanTypes,
List<Annotation> qualifiers)
{
this.beanManager = beanManager;
this.wrapped = wrapped;
this.beanTypes = beanTypes;
this.qualifiers = qualifiers;
}
示例12: EntityManagerProducerProxy
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
public EntityManagerProducerProxy(final Producer<EntityManager> proxied) {
this.proxied = proxied;
}
示例13: camelContextProducer
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
<T extends CamelContext> Producer<T> camelContextProducer(Producer<T> delegate, Annotated annotated, BeanManager manager, CdiCamelExtension extension) {
CamelContextProducer<T> producer = new CamelContextProducer<>(delegate, annotated, manager, extension);
return hasBundleContext ? new CamelContextOsgiProducer<>(producer) : producer;
}
示例14: DelegateInjectionTarget
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
DelegateInjectionTarget(InjectionTarget<T> target, Producer<T> producer) {
super(producer);
this.delegate = target;
}
示例15: CamelContextInjectionTarget
import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
CamelContextInjectionTarget(InjectionTarget<T> target, Producer<T> producer) {
super(target, producer);
}