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


Java NormalScope类代码示例

本文整理汇总了Java中javax.enterprise.context.NormalScope的典型用法代码示例。如果您正苦于以下问题:Java NormalScope类的具体用法?Java NormalScope怎么用?Java NormalScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NormalScope类属于javax.enterprise.context包,在下文中一共展示了NormalScope类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scope

import javax.enterprise.context.NormalScope; //导入依赖的package包/类
public Class<? extends Annotation> scope() {
    if (null == scope) {
        synchronized (this) {
            if (null == scope) {
                Class<?> c = getClass();
                if (c.isAnnotationPresent(RequestScoped.class)) {
                    scope = RequestScoped.class;
                } else if (c.isAnnotationPresent(SessionScoped.class)) {
                    scope = SessionScoped.class;
                } else if (c.isAnnotationPresent(ApplicationScoped.class)) {
                    scope = ApplicationScoped.class;
                } else {
                    scope = NormalScope.class;
                }
            }
        }
    }
    return scope;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:20,代码来源:DestroyableBase.java

示例2: activate

import javax.enterprise.context.NormalScope; //导入依赖的package包/类
/**
 * Activate and deactivate contexts for the given normal scopes for each test method execution.
 * <p>
 * {@link ApplicationScoped} is ignored as it is always active.
 * </p>
 *
 * @param normalScopes
 * @return self
 */
@SafeVarargs
public final T activate(Class<? extends Annotation>... normalScopes) {
    for (Class<? extends Annotation> scope : normalScopes) {
        if (ApplicationScoped.class.equals(scope)) {
            continue;
        }
        if (!scope.isAnnotationPresent(NormalScope.class)) {
            throw new IllegalArgumentException("Only annotations annotated with @NormalScope are supported!");
        }
        this.scopesToActivate.add(scope);
    }
    return self();
}
 
开发者ID:weld,项目名称:weld-junit,代码行数:23,代码来源:AbstractWeldInitiator.java


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