Example usage for org.springframework.ide.eclipse.beans.core.model IBeanProperty getValue

List of usage examples for org.springframework.ide.eclipse.beans.core.model IBeanProperty getValue

Introduction

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

Prototype

Object getValue();

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;
                }/*www .j  a v a2 s.  c  o  m*/
            }
        }
    }

    return null;
}

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();
}