本文整理汇总了Java中javax.enterprise.inject.spi.ProcessObserverMethod类的典型用法代码示例。如果您正苦于以下问题:Java ProcessObserverMethod类的具体用法?Java ProcessObserverMethod怎么用?Java ProcessObserverMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessObserverMethod类属于javax.enterprise.inject.spi包,在下文中一共展示了ProcessObserverMethod类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerMessageEvent
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
/**
*
* @param e
* @param beanManager
*/
public void registerMessageEvent(@Observes ProcessObserverMethod<Message, ?> e) {
final ObserverMethod<Message> method = e.getObserverMethod();
for (Annotation a : method.getObservedQualifiers()) {
if (a instanceof OnConnected) {
registerMessageObserver(OnConnected.class, method);
// e.veto(); // CDI 2.0
} else if (a instanceof OnSend) {
registerMessageObserver(OnSend.class, method);
// e.veto(); // CDI 2.0
} else if (a instanceof OnSubscribe) {
registerMessageObserver(OnSubscribe.class, method);
// e.veto(); // CDI 2.0
} else if (a instanceof OnUnsubscribe) {
registerMessageObserver(OnUnsubscribe.class, method);
// e.veto(); // CDI 2.0
} else if (a instanceof OnDisconnect) {
registerMessageObserver(OnDisconnect.class, method);
// e.veto(); // CDI 2.0
}
}
}
开发者ID:dansiviter,项目名称:cito,代码行数:27,代码来源:Extension.java
示例2: register_onConnected
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void register_onConnected() {
final ProcessObserverMethod<Message, ?> processObserverMethod = mock(ProcessObserverMethod.class);
final ObserverMethod<Message> observerMethod = mock(ObserverMethod.class);
when(processObserverMethod.getObserverMethod()).thenReturn(observerMethod);
when(observerMethod.getObservedQualifiers()).thenReturn(singleton(OnConnected.Literal.onConnected()));
this.extension.registerMessageEvent(processObserverMethod);
assertEquals(observerMethod, getMessageObservers(this.extension).get(OnConnected.class).iterator().next());
verify(processObserverMethod).getObserverMethod();
verify(observerMethod).getObservedQualifiers();
verifyNoMoreInteractions(processObserverMethod, observerMethod);
}
开发者ID:dansiviter,项目名称:cito,代码行数:17,代码来源:ExtensionTest.java
示例3: register_onSend
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void register_onSend() {
final ProcessObserverMethod<Message, ?> processObserverMethod = mock(ProcessObserverMethod.class);
final ObserverMethod<Message> observerMethod = mock(ObserverMethod.class);
when(processObserverMethod.getObserverMethod()).thenReturn(observerMethod);
when(observerMethod.getObservedQualifiers()).thenReturn(singleton(onSend("")));
this.extension.registerMessageEvent(processObserverMethod);
assertEquals(observerMethod, getMessageObservers(this.extension).get(OnSend.class).iterator().next());
verify(processObserverMethod).getObserverMethod();
verify(observerMethod).getObservedQualifiers();
verifyNoMoreInteractions(processObserverMethod, observerMethod);
}
开发者ID:dansiviter,项目名称:cito,代码行数:17,代码来源:ExtensionTest.java
示例4: register_onSubscribe
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void register_onSubscribe() {
final ProcessObserverMethod<Message, ?> processObserverMethod = mock(ProcessObserverMethod.class);
final ObserverMethod<Message> observerMethod = mock(ObserverMethod.class);
when(processObserverMethod.getObserverMethod()).thenReturn(observerMethod);
when(observerMethod.getObservedQualifiers()).thenReturn(singleton(onSubscribe("")));
this.extension.registerMessageEvent(processObserverMethod);
assertEquals(observerMethod, getMessageObservers(this.extension).get(OnSubscribe.class).iterator().next());
verify(processObserverMethod).getObserverMethod();
verify(observerMethod).getObservedQualifiers();
verifyNoMoreInteractions(processObserverMethod, observerMethod);
}
开发者ID:dansiviter,项目名称:cito,代码行数:17,代码来源:ExtensionTest.java
示例5: register_onUnsubscribe
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void register_onUnsubscribe() {
final ProcessObserverMethod<Message, ?> processObserverMethod = mock(ProcessObserverMethod.class);
final ObserverMethod<Message> observerMethod = mock(ObserverMethod.class);
when(processObserverMethod.getObserverMethod()).thenReturn(observerMethod);
when(observerMethod.getObservedQualifiers()).thenReturn(singleton(onUnsubscribe("")));
this.extension.registerMessageEvent(processObserverMethod);
assertEquals(observerMethod, getMessageObservers(this.extension).get(OnUnsubscribe.class).iterator().next());
verify(processObserverMethod).getObserverMethod();
verify(observerMethod).getObservedQualifiers();
verifyNoMoreInteractions(processObserverMethod, observerMethod);
}
开发者ID:dansiviter,项目名称:cito,代码行数:17,代码来源:ExtensionTest.java
示例6: register_onDisconnect
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void register_onDisconnect() {
final ProcessObserverMethod<Message, ?> processObserverMethod = mock(ProcessObserverMethod.class);
final ObserverMethod<Message> observerMethod = mock(ObserverMethod.class);
when(processObserverMethod.getObserverMethod()).thenReturn(observerMethod);
when(observerMethod.getObservedQualifiers()).thenReturn(singleton(onDisconnect()));
this.extension.registerMessageEvent(processObserverMethod);
assertEquals(observerMethod, getMessageObservers(this.extension).get(OnDisconnect.class).iterator().next());
verify(processObserverMethod).getObserverMethod();
verify(observerMethod).getObservedQualifiers();
verifyNoMoreInteractions(processObserverMethod, observerMethod);
}
开发者ID:dansiviter,项目名称:cito,代码行数:17,代码来源:ExtensionTest.java
示例7: camelEventNotifiers
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
private <T extends EventObject> void camelEventNotifiers(@Observes ProcessObserverMethod<T, ?> pom) {
// Only activate Camel event notifiers for explicit Camel event observers, that is, an observer method for a super type won't activate notifiers.
Type type = pom.getObserverMethod().getObservedType();
// Camel events are raw types
if (type instanceof Class && Class.class.cast(type).getPackage().equals(AbstractExchangeEvent.class.getPackage())) {
Set<Annotation> qualifiers = pom.getObserverMethod().getObservedQualifiers();
if (qualifiers.isEmpty()) {
eventQualifiers.add(ANY);
} else if (qualifiers.size() == 1 && qualifiers.stream()
.filter(isAnnotationType(Named.class)).findAny().isPresent()) {
eventQualifiers.add(DEFAULT);
} else {
eventQualifiers.addAll(qualifiers);
}
}
}
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:CdiCamelExtension.java
示例8: registerDestinationEvent
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
/**
*
* @param e
* @param beanManager
*/
public void registerDestinationEvent(@Observes ProcessObserverMethod<DestinationChanged, ?> e) {
final ObserverMethod<DestinationChanged> method = e.getObserverMethod();
for (Annotation a : method.getObservedQualifiers()) {
if (a instanceof OnAdded)
registerDestinationObserver(OnAdded.class, method);
if (a instanceof OnRemoved)
registerDestinationObserver(OnRemoved.class, method);
}
}
开发者ID:dansiviter,项目名称:cito,代码行数:15,代码来源:Extension.java
示例9: processVertxEventObserver
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
public void processVertxEventObserver(@Observes ProcessObserverMethod<VertxEvent, ?> event) {
String vertxAddress = getVertxAddress(event.getObserverMethod());
if (vertxAddress == null) {
LOGGER.warn("VertxEvent observer found but no @VertxConsumer declared: {0}", event.getObserverMethod());
return;
}
LOGGER.debug("Vertx message consumer found: {0}", event.getObserverMethod());
consumerAddresses.add(vertxAddress);
}
开发者ID:weld,项目名称:weld-vertx,代码行数:10,代码来源:VertxExtension.java
示例10: camelEventNotifiers
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
private <T extends EventObject> void camelEventNotifiers(@Observes ProcessObserverMethod<T, ?> pom) {
// Only activate Camel event notifiers for explicit Camel event observers, that is,
// an observer method for a super type won't activate notifiers.
Type type = pom.getObserverMethod().getObservedType();
// Camel events are raw types
if (type instanceof Class && Class.class.cast(type).getPackage().equals(AbstractExchangeEvent.class.getPackage())) {
Set<Annotation> qualifiers = pom.getObserverMethod().getObservedQualifiers();
if (qualifiers.isEmpty())
eventQualifiers.add(ANY);
else if (qualifiers.size() == 1 && qualifiers.stream().anyMatch(isAnnotationType(Named.class)))
eventQualifiers.add(DEFAULT);
else
eventQualifiers.addAll(qualifiers);
}
}
开发者ID:astefanutti,项目名称:camel-cdi,代码行数:16,代码来源:CdiCamelExtension.java
示例11: processObserverMethod
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
<K, V> void processObserverMethod(@Observes ProcessObserverMethod<K, V> pom) {
logger.info("finished the scanning process");
processObserverMethod++;
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:5,代码来源:ObserverExtension.java
示例12: processObserverMethod
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
private final <X> void processObserverMethod(@Observes final ProcessObserverMethod<Event, X> event, final BeanManager beanManager) {
if (event != null && beanManager != null && !this.startWatcher && event.getObserverMethod() != null) {
this.startWatcher = true;
}
}
开发者ID:microbean,项目名称:microbean-kubernetes-client-cdi,代码行数:6,代码来源:KubernetesClientExtension.java
示例13: logLifecycleEvent
import javax.enterprise.inject.spi.ProcessObserverMethod; //导入依赖的package包/类
<T, X> void logLifecycleEvent(@Observes ProcessObserverMethod<T, X> event) {
LOGGER.info("ProcessObserverMethod: observerMethod" + event.getObserverMethod());
}
开发者ID:ghajba,项目名称:Java-EE,代码行数:4,代码来源:LifeCycleLogger.java
注:本文中的javax.enterprise.inject.spi.ProcessObserverMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论