Example usage for org.springframework.ide.eclipse.beans.core.model IBean getProperty

List of usage examples for org.springframework.ide.eclipse.beans.core.model IBean getProperty

Introduction

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

Prototype

IBeanProperty getProperty(String name);

Source Link

Usage

From source file:org.synyx.hades.eclipse.HadesUtils.java

/**
 * Returns the DAO interface name for the given bean.
 * //from  w ww.j a  v a2  s.c  o  m
 * @param bean
 * @return
 */
public static String getDaoInterfaceName(IBean bean) {

    IBeansTypedString property = (IBeansTypedString) bean.getProperty("daoInterface").getValue();
    return property.getString();
}

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

public static IModelElement[] getPossibleCCIMappingForMappingFile(IBean bean) {
    if (bean == null)
        return null;

    //get customConvertersWithId-property
    IBeanProperty ccwiProperty = bean.getProperty("customConvertersWithId");

    //no customConvertersWithId property, return at least the bean
    if (ccwiProperty == null)
        return null;

    BeansMap ccwiPropertyValues = (BeansMap) ccwiProperty.getValue();
    return ccwiPropertyValues.getElementChildren();
}

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 va2 s  . co m
            }
        }
    }

    return null;
}