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


Java Stateful类代码示例

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


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

示例1: getEjbs

import javax.ejb.Stateful; //导入依赖的package包/类
public synchronized Collection<EjbDescriptorImpl<?>> getEjbs() {
    if (ejbs == null) {
        ejbs = classpathEntry.annotatedWith(Singleton.class, Stateless.class, Stateful.class).stream()
                .map(this::toEjbDescriptor)
                .collect(Collectors.toSet());
    }
    return ejbs;
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:9,代码来源:BeanArchive.java

示例2: getSessionType

import javax.ejb.Stateful; //导入依赖的package包/类
private SessionType getSessionType(final Class<?> clazz) {
    if (clazz.isAnnotationPresent(Stateful.class)) {
        return SessionType.STATEFUL;
    }
    if (clazz.isAnnotationPresent(Stateless.class)) {
        return SessionType.STATELESS;
    }
    if (clazz.isAnnotationPresent(Singleton.class)) {
        return SessionType.SINGLETON;
    }
    if (clazz.isAnnotationPresent(ManagedBean.class)) {
        return SessionType.MANAGED;
    }
    return null;
}
 
开发者ID:apache,项目名称:tomee,代码行数:16,代码来源:AnnotationDeployer.java

示例3: isStateful

import javax.ejb.Stateful; //导入依赖的package包/类
@Override
public boolean isStateful() {
    return getBeanClass().getAnnotation(Stateful.class) != null;
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:5,代码来源:EjbDescriptorImpl.java

示例4: getEjbName

import javax.ejb.Stateful; //导入依赖的package包/类
private String getEjbName(final Stateful stateful, final Class<?> beanClass) {
    return stateful.name().isEmpty() ? beanClass.getSimpleName() : stateful.name();
}
 
开发者ID:apache,项目名称:tomee,代码行数:4,代码来源:AnnotationDeployer.java

示例5: isValidEjbAnnotationUsage

import javax.ejb.Stateful; //导入依赖的package包/类
private boolean isValidEjbAnnotationUsage(final Class annotationClass, final Annotated<Class<?>> beanClass, final String ejbName, final EjbModule ejbModule) {
    final List<Class<? extends Annotation>> annotations = new ArrayList(Arrays.asList(Singleton.class, Stateless.class, Stateful.class, MessageDriven.class));
    annotations.remove(annotationClass);

    final boolean b = true;
    for (final Class<? extends Annotation> secondAnnotation : annotations) {
        final Annotation annotation = beanClass.getAnnotation(secondAnnotation);

        if (annotation == null) {
            continue;
        }

        String secondEjbName = null;
        if (annotation instanceof Stateful) {
            secondEjbName = getEjbName((Stateful) annotation, beanClass.get());
        } else if (annotation instanceof Stateless) {
            secondEjbName = getEjbName((Stateless) annotation, beanClass.get());
        } else if (annotation instanceof Singleton) {
            secondEjbName = getEjbName((Singleton) annotation, beanClass.get());
        } else if (annotation instanceof MessageDriven) {
            secondEjbName = getEjbName((MessageDriven) annotation, beanClass.get());
        }

        if (ejbName.equals(secondEjbName)) {
            ejbModule.getValidation().fail(ejbName, "multiplyAnnotatedAsBean", annotationClass.getSimpleName(), secondAnnotation.getSimpleName(), ejbName, beanClass.get().getName());
        }
    }

    if (beanClass.get().isInterface()) {
        if (!CheckClasses.isAbstractAllowed(beanClass.get())) {
            ejbModule.getValidation().fail(ejbName, "interfaceAnnotatedAsBean", annotationClass.getSimpleName(), beanClass.get().getName());
            return false;
        }
    } else if (Modifier.isAbstract(beanClass.get().getModifiers())) {
        if (!CheckClasses.isAbstractAllowed(beanClass.get())) {
            ejbModule.getValidation().fail(ejbName, "abstractAnnotatedAsBean", annotationClass.getSimpleName(), beanClass.get().getName());
            return false;
        }
    }

    return b;
}
 
开发者ID:apache,项目名称:tomee,代码行数:43,代码来源:AnnotationDeployer.java

示例6: isEJB

import javax.ejb.Stateful; //导入依赖的package包/类
private static boolean isEJB(final Class<?> clazz) {
    return clazz.isAnnotationPresent(Stateless.class)
        || clazz.isAnnotationPresent(Singleton.class)
        || clazz.isAnnotationPresent(ManagedBean.class)  // what a weird idea!
        || clazz.isAnnotationPresent(Stateful.class); // what another weird idea!
}
 
开发者ID:apache,项目名称:tomee,代码行数:7,代码来源:AnnotationDeployer.java


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