Example usage for org.springframework.context.support GenericApplicationContext getType

List of usage examples for org.springframework.context.support GenericApplicationContext getType

Introduction

In this page you can find the example usage for org.springframework.context.support GenericApplicationContext getType.

Prototype

@Override
    @Nullable
    public Class<?> getType(String name) throws NoSuchBeanDefinitionException 

Source Link

Usage

From source file:org.pentaho.platform.plugin.services.pluginmgr.DefaultPluginManager.java

@Override
public Class<?> loadClass(String beanId) throws PluginBeanException {
    if (beanId == null) {
        throw new IllegalArgumentException("beanId cannot be null"); //$NON-NLS-1$
    }/*  w w  w . j  a  v  a 2 s.  co m*/
    Class<?> type = null;
    for (GenericApplicationContext beanFactory : beanFactoryMap.values()) {
        if (beanFactory.containsBean(beanId)) {
            try {
                type = beanFactory.getType(beanId);
                break;
            } catch (Throwable ex) { // Catching throwable on purpose
                throw new PluginBeanException(ex);
            }
        }
    }

    if (type == null) {
        throw new PluginBeanException(
                Messages.getInstance().getString("PluginManager.WARN_CLASS_NOT_REGISTERED", beanId)); //$NON-NLS-1$
    }
    return type;
}