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


Java ManagedBean类代码示例

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


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

示例1: bindAllManagedBeans

import javax.annotation.ManagedBean; //导入依赖的package包/类
/**
 * Binds all classes annotated with ManagedBean in the given package.
 *
 * @param packageName - the name of the package to search in
 */
private void bindAllManagedBeans(String packageName) {
  Iterable<Class<?>> managedBeanClasses =
      new Reflections(packageName).getTypesAnnotatedWith(ManagedBean.class);

  for (Class<?> managedBeanClass : managedBeanClasses) {
    bind(managedBeanClass).to(managedBeanClass);
  }
}
 
开发者ID:vita-us,项目名称:ViTA,代码行数:14,代码来源:Hk2Application.java

示例2: getSessionType

import javax.annotation.ManagedBean; //导入依赖的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: isIgnoredReferenceType

import javax.annotation.ManagedBean; //导入依赖的package包/类
private boolean isIgnoredReferenceType(final String typeName, final ClassLoader loader) {
    if (ignoredReferenceTypes.contains(typeName)) {
        return true;
    } else if (loader != null) {
        try {
            final Class<?> type = loader.loadClass(typeName);
            return type.isAnnotationPresent(ManagedBean.class);
        } catch (final ClassNotFoundException e) {
            // ignore
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:tomee,代码行数:14,代码来源:AutoConfig.java

示例4: updateContext

import javax.annotation.ManagedBean; //导入依赖的package包/类
public void updateContext(Collection<Class> classes) {
    if (beanFactory != null) {
        boolean needToRefreshRemotingContext = false;
        for (Class clazz : classes) {
            Service serviceAnnotation = (Service) clazz.getAnnotation(Service.class);
            ManagedBean managedBeanAnnotation = (ManagedBean) clazz.getAnnotation(ManagedBean.class);
            Component componentAnnotation = (Component) clazz.getAnnotation(Component.class);
            Controller controllerAnnotation = (Controller) clazz.getAnnotation(Controller.class);

            String beanName = null;
            if (serviceAnnotation != null) {
                beanName = serviceAnnotation.value();
            } else if (managedBeanAnnotation != null) {
                beanName = managedBeanAnnotation.value();
            } else if (componentAnnotation != null) {
                beanName = componentAnnotation.value();
            } else if (controllerAnnotation != null) {
                beanName = controllerAnnotation.value();
            }

            if (StringUtils.isNotBlank(beanName)) {
                GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
                beanDefinition.setBeanClass(clazz);
                Scope scope = (Scope) clazz.getAnnotation(Scope.class);
                if (scope != null) {
                    beanDefinition.setScope(scope.value());
                }

                beanFactory.registerBeanDefinition(beanName, beanDefinition);
            }

            if (StringUtils.isNotBlank(beanName)) {
                needToRefreshRemotingContext = true;
            }
        }

        if (needToRefreshRemotingContext) {
            ApplicationContext remotingContext = RemotingContextHolder.getRemotingApplicationContext();
            if (remotingContext != null && remotingContext instanceof ConfigurableApplicationContext) {
                ((ConfigurableApplicationContext) remotingContext).refresh();
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:45,代码来源:SpringBeanLoader.java

示例5: getEjbName

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

示例6: isEJB

import javax.annotation.ManagedBean; //导入依赖的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.annotation.ManagedBean类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。