本文整理匯總了Java中javax.ejb.Stateless類的典型用法代碼示例。如果您正苦於以下問題:Java Stateless類的具體用法?Java Stateless怎麽用?Java Stateless使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Stateless類屬於javax.ejb包,在下文中一共展示了Stateless類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readBeanNames
import javax.ejb.Stateless; //導入依賴的package包/類
/**
* Reads EJB {@link Stateless} bean names from appropriated archives
*
* @param archives
* @return
* @throws IOException
*/
private Set<String> readBeanNames(URL[] archives) throws IOException {
Set<String> beanNames;
URL[] fullArchives = getFullArchives(archives);
annotationFinder = new AnnotationFinder();
annotationFinder.setScanFieldAnnotations(Boolean.FALSE);
annotationFinder.setScanParameterAnnotations(Boolean.FALSE);
annotationFinder.setScanMethodAnnotations(Boolean.FALSE);
annotationFinder.scanArchives(fullArchives);
beanNames = annotationFinder.getAnnotationIndex().get(Stateless.class.getName());
classOwnersURL = annotationFinder.getClassOwnersURLs();
return beanNames;
}
示例2: getEjbs
import javax.ejb.Stateless; //導入依賴的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;
}
示例3: isNeglectableClass
import javax.ejb.Stateless; //導入依賴的package包/類
@Override
public boolean isNeglectableClass(Class<?> clazz) {
boolean isNoClass = clazz.isEnum() || clazz.isInterface()
|| Modifier.isAbstract(clazz.getModifiers());
Stateless annotation = clazz.getAnnotation(Stateless.class);
return !(annotation != null && !isNoClass);
}
示例4: getSessionType
import javax.ejb.Stateless; //導入依賴的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;
}
示例5: beanName
import javax.ejb.Stateless; //導入依賴的package包/類
/**
* Gets EJB bean name from passed {@link Class} instance
*
* @param beanClass
* @return {@link String} EJB bean name
*/
public static String beanName(Class<?> beanClass) {
String beanEjbName;
Stateless annotation = beanClass.getAnnotation(Stateless.class);
beanEjbName = annotation.name();
if (StringUtils.invalid(beanEjbName)) {
beanEjbName = beanClass.getSimpleName();
}
return beanEjbName;
}
示例6: isStateless
import javax.ejb.Stateless; //導入依賴的package包/類
@Override
public boolean isStateless() {
return getBeanClass().getAnnotation(Stateless.class) != null;
}
示例7: getEjbName
import javax.ejb.Stateless; //導入依賴的package包/類
private String getEjbName(final Stateless stateless, final Class<?> beanClass) {
return stateless.name().isEmpty() ? beanClass.getSimpleName() : stateless.name();
}
示例8: isValidEjbAnnotationUsage
import javax.ejb.Stateless; //導入依賴的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;
}
示例9: isEJB
import javax.ejb.Stateless; //導入依賴的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!
}
示例10: processInjectionTarget
import javax.ejb.Stateless; //導入依賴的package包/類
/**
* Replaces the meta data of the {@link ProcessAnnotatedType}.
*
* <p>
* The ProcessAnnotatedType's meta data will be replaced, if the annotated type has one of the following annotations:
* <ul>
* <li> {@link Stateless}
* <li> {@link MessageDriven}
* <li> {@link Interceptor}
* <li> {@link Singleton}
* </ul>
*
* @param <X> the type of the ProcessAnnotatedType
* @param pat the annotated type representing the class being processed
*/
public <X> void processInjectionTarget(@Observes @WithAnnotations({Stateless.class, MessageDriven.class, Interceptor.class, Singleton.class}) ProcessAnnotatedType<X> pat) {
if (pat.getAnnotatedType().isAnnotationPresent(Stateless.class) || pat.getAnnotatedType().isAnnotationPresent(MessageDriven.class)) {
modifiyAnnotatedTypeMetadata(pat);
} else if (pat.getAnnotatedType().isAnnotationPresent(Interceptor.class)) {
processInterceptorDependencies(pat);
} else if(pat.getAnnotatedType().isAnnotationPresent(Singleton.class)) {
addApplicationScopedAndTransactionalToSingleton(pat);
}
}