Java 类javax.ejb.Stateful 实例源码

项目:testee.fi    文件:BeanArchive.java   
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;
}
项目:tomee    文件:AnnotationDeployer.java   
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;
}
项目:testee.fi    文件:EjbDescriptorImpl.java   
@Override
public boolean isStateful() {
    return getBeanClass().getAnnotation(Stateful.class) != null;
}
项目:tomee    文件:AnnotationDeployer.java   
private String getEjbName(final Stateful stateful, final Class<?> beanClass) {
    return stateful.name().isEmpty() ? beanClass.getSimpleName() : stateful.name();
}
项目:tomee    文件:AnnotationDeployer.java   
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;
}
项目:tomee    文件:AnnotationDeployer.java   
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!
}