当前位置: 首页>>代码示例>>Java>>正文


Java Producer类代码示例

本文整理汇总了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();
                }
            };
        }
    };
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:24,代码来源:MockingExtension.java

示例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));
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:18,代码来源:JpaUnitCdiExtensionTest.java

示例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);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:14,代码来源:AxonCdiExtension.java

示例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);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:14,代码来源:AxonCdiExtension.java

示例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);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:12,代码来源:AxonCdiExtension.java

示例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);
	}
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:12,代码来源:AxonCdiExtension.java

示例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;
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:8,代码来源:AbstractAutoConfiguringProducer.java

示例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);
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:10,代码来源:AutoConfiguringEventStoreProducer.java

示例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;
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:10,代码来源:AutoConfiguringCommandBusProducer.java

示例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;
}
 
开发者ID:apache,项目名称:deltaspike,代码行数:11,代码来源:MockAwareProducerWrapper.java

示例12: EntityManagerProducerProxy

import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
public EntityManagerProducerProxy(final Producer<EntityManager> proxied) {
    this.proxied = proxied;
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:4,代码来源:EntityManagerProducerProxy.java

示例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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:CdiCamelEnvironment.java

示例14: DelegateInjectionTarget

import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
DelegateInjectionTarget(InjectionTarget<T> target, Producer<T> producer) {
    super(producer);
    this.delegate = target;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:DelegateInjectionTarget.java

示例15: CamelContextInjectionTarget

import javax.enterprise.inject.spi.Producer; //导入依赖的package包/类
CamelContextInjectionTarget(InjectionTarget<T> target, Producer<T> producer) {
    super(target, producer);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:CamelContextInjectionTarget.java


注:本文中的javax.enterprise.inject.spi.Producer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。