當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。