Example usage for org.springframework.ide.eclipse.beans.core.internal.model BeansList getElementChildren

List of usage examples for org.springframework.ide.eclipse.beans.core.internal.model BeansList getElementChildren

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.beans.core.internal.model BeansList getElementChildren.

Prototype

@Override
    public IModelElement[] getElementChildren() 

Source Link

Usage

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

protected static IBean getDozerBeanFromBeans(Set<IBean> beans, String mappingFileName) {
    //get first bean that uses our mapping file
    for (IBean bean : beans) {
        String className = BeansModelUtils.getBeanClass(bean, null);
        if ("org.dozer.util.mapping.DozerBeanMapper".equals(className)) {
            //get mappingFiles-property
            IBeanProperty mappingFilesProperty = bean.getProperty("mappingFiles");
            if (mappingFilesProperty == null)
                continue;

            BeansList mappingFilesPropertyValues = (BeansList) mappingFilesProperty.getValue();
            IModelElement[] modelElements = mappingFilesPropertyValues.getElementChildren();

            //find reference to our mapping file
            for (IModelElement modelElement : modelElements) {
                String configFilePath = ((BeansTypedString) modelElement).getString();
                File configFile = new File(configFilePath);

                //property with mapping file found, so this is our target bean
                if (mappingFileName.equals(configFile.getName())) {
                    return bean;
                }/*from w w w  .j a  v  a2s  . co m*/
            }
        }
    }

    return null;
}