use of org.apache.deltaspike.core.impl.scope.conversation.ConversationKey in project deltaspike by apache.
the class ConversationUtils method convertToConversationKey.
public static ConversationKey convertToConversationKey(Contextual<?> contextual, BeanManager beanManager) {
if (!(contextual instanceof Bean)) {
if (contextual instanceof PassivationCapable) {
contextual = beanManager.getPassivationCapableBean(((PassivationCapable) contextual).getId());
} else {
throw new IllegalArgumentException(contextual.getClass().getName() + " is not of type " + Bean.class.getName());
}
}
Bean<?> bean = (Bean<?>) contextual;
//don't cache it (due to the support of different producers)
ConversationGroup conversationGroupAnnotation = findConversationGroupAnnotation(bean);
Class<?> conversationGroup;
if (conversationGroupAnnotation != null) {
conversationGroup = conversationGroupAnnotation.value();
} else {
conversationGroup = bean.getBeanClass();
}
Set<Annotation> qualifiers = bean.getQualifiers();
return new ConversationKey(conversationGroup, qualifiers.toArray(new Annotation[qualifiers.size()]));
}
Aggregations