Example usage for org.springframework.ide.eclipse.beans.core.model IBeansConfig getBean

List of usage examples for org.springframework.ide.eclipse.beans.core.model IBeansConfig getBean

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.beans.core.model IBeansConfig getBean.

Prototype

IBean getBean(String name);

Source Link

Usage

From source file:org.dozer.eclipse.plugin.sourcepage.util.DozerPluginUtils.java

public static String getClassNameForCCI(IFile mappingIFile, String customConverterId) {
    IBean bean = getDozerBeanForMappingFile(mappingIFile);

    if (bean == null)
        return null;

    BeansMapEntry beansMapEntry = getCCIModelElementForMappingFile(bean, customConverterId);

    if (beansMapEntry != null) {
        if (beansMapEntry.getValue() instanceof Bean) {
            Bean cciBean = (Bean) beansMapEntry.getValue();
            return cciBean.getBeanDefinition().getBeanClassName();
        } else if (beansMapEntry.getValue() instanceof BeanReference) {
            BeanReference beanRef = (BeanReference) beansMapEntry.getValue();
            String beanName = beanRef.getBeanName();

            Set<IBeansProject> projects = BeansCorePlugin.getModel().getProjects();
            for (IBeansProject beansProject : projects) {
                Set<IBeansConfig> tempConfigs = beansProject.getConfigs();
                for (IBeansConfig config : tempConfigs) {
                    IBean foundBean = config.getBean(beanName);
                    if (foundBean != null) {
                        return foundBean.getClassName();
                    }/*from   w  w w.j  a  v a 2  s  . c  om*/
                }
            }
        }
    }

    return null;
}