You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Gerhard Petracek (JIRA)" <ji...@apache.org> on 2015/01/27 19:02:35 UTC
[jira] [Commented] (DELTASPIKE-805) Provide utils method to check
if an context is active or not
[ https://issues.apache.org/jira/browse/DELTASPIKE-805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14293886#comment-14293886 ]
Gerhard Petracek commented on DELTASPIKE-805:
---------------------------------------------
since we have BeanUtils for beans, i would create a class ContextUtils or ScopeUtils for such helper methods
> Provide utils method to check if an context is active or not
> ------------------------------------------------------------
>
> Key: DELTASPIKE-805
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-805
> Project: DeltaSpike
> Issue Type: Improvement
> Components: Core
> Reporter: Thomas Andraschko
> Assignee: Thomas Andraschko
> Fix For: 1.3.0
>
>
> public boolean isContextActive(Class<? extends Annotation> scopeAnnotationClass)
> {
> try
> {
> BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
> if (beanManager.getContext(scopeAnnotationClass) == null || !beanManager.getContext(scopeAnnotationClass).isActive())
> {
> return false;
> }
> }
> catch (ContextNotActiveException cnae)
> {
> return false;
> }
> return true;
> }
> Any idea where i could add this method?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)