Examples of BeanMapper


Examples of com.mossle.core.mapper.BeanMapper

    public void init() {
        this.basicDataSource = createBasicDataSource();

        dataSourceInfo.validate();
        new BeanMapper().copy(dataSourceInfo, basicDataSource);

        try {
            new DataSourceChecker().check(basicDataSource);
        } catch (SQLException ex) {
            logger.warn(ex.getMessage(), ex);
View Full Code Here

Examples of com.mysema.query.sql.dml.BeanMapper

    @Test
    public void Populate_With_BeanMapper() {
        Employee employee = new Employee();
        employee.setFirstname("John");
        insert(e).populate(employee, new BeanMapper()).execute();
    }
View Full Code Here

Examples of net.freedom.gj.beans.mapper.BeanMapper

        b1.setValue(new BigDecimal("1000"));
        b1.setAddress(new Address("123 Main st","","","Sarasota","FL","0000"));


        // get an instance of bean mapper
        BeanMapper mapper = configureBeanMapper();

        // map object A to another object B
        EntityBeanB b2 = mapper.map(b1, new EntityBeanB());

        // Assert for correctness
        assertEquals(b1.getMyDate().toString(), (String)b2.getExtension().get("myDate") );
        assertEquals(b1.getName(), b2.getExtension().get("myName") );
        assertNotNull(b2.getEntityGroups());
View Full Code Here

Examples of net.freedom.gj.beans.mapper.BeanMapper

        b1.setValue(new BigDecimal("1000"));
        b1.setAddress(new Address("123 Main st","","","Sarasota","FL","0000"));


        // get an instance of bean mapper
        BeanMapper mapper = configureBeanMapper();

        // map object A to another object B
        EntityBeanB b2 = mapper.map(b1, new EntityBeanB());

        // Assert for correctness
        assertEquals(b1.getMyDate().toString(), (String)b2.getExtension().get("myDate") );
        assertEquals(b1.getName(), b2.getExtension().get("myName") );
        assertNotNull(b2.getEntityGroups());
View Full Code Here

Examples of org.araneaframework.backend.util.BeanMapper

   
    form.addBeanElement(fullId, label, control, mandatory);
  }
 
  private static Class getBeanFieldType(Class beanClass, String fullId) {
    BeanMapper beanMapper = new BeanMapper(beanClass);
   
    String fieldId, nextFullId;
   
    if (fullId.indexOf(".") != -1) {
      fieldId = fullId.substring(0, fullId.indexOf("."));
      nextFullId = fullId.substring(fieldId.length() + 1);
    } else {
      fieldId = fullId;
      nextFullId = null;
    }
   
    if (!beanMapper.fieldExists(fieldId)) {
      throw new AraneaRuntimeException("Could not infer type for bean field '" + fullId + "'!");     
    }
   
    if (nextFullId != null) {
      return getBeanFieldType(beanMapper.getBeanFieldType(fieldId), nextFullId)
    }
    return beanMapper.getBeanFieldType(fullId);
  }
View Full Code Here

Examples of org.araneaframework.backend.util.BeanMapper

   * @param valueName the name of the Value Object field corresponding to the value of the select item.
   * @param displayStringName the name of the Value Object field corresponding to the display string of the select item.
   */
  public static void addItemsFromVoCollection(DisplayItemContainer displayItems, Collection valueObjects, String valueName, String displayStringName) {
    if (valueObjects.size() == 0) return;
    BeanMapper beanMapper = new BeanMapper(valueObjects.iterator().next().getClass());

    for (Iterator i = valueObjects.iterator(); i.hasNext();) {
      Object vo = i.next();
      displayItems.addItem(new DisplayItem(beanMapper.getBeanFieldValue(vo, valueName).toString(), beanMapper.getBeanFieldValue(vo,
          displayStringName).toString()));
    }
  }
View Full Code Here

Examples of org.araneaframework.backend.util.BeanMapper

   * Creates the class initializing the Value Object class.
   *
   * @param voClass the Value Object class.
   */
  public BeanFormWriter(Class voClass) {
    beanMapper = new BeanMapper(voClass);
  }
View Full Code Here

Examples of org.araneaframework.backend.util.BeanMapper

   *
   * @param vo
   *          Value Object to write to.
   */
  public void readFormBean(Object vo) {
    BeanMapper beanMapper = new BeanMapper(vo.getClass());
    for (Iterator i = compositeFormElement.getElements().entrySet().iterator(); i.hasNext();) {
      Map.Entry entry = (Map.Entry) i.next();
     
      GenericFormElement element = (GenericFormElement) entry.getValue();
      String elementId = (String) entry.getKey();
     
      if (element instanceof FormElement) {
        if (beanMapper.fieldIsWritable(elementId)) {
          Data data = ((FormElement) element).getData();
          if (data != null) {
            beanMapper.setBeanFieldValue(vo, elementId, data.getValue());
          }
        }
      }
      else if (element instanceof FormWidget) {
        if (beanMapper.fieldIsWritable(elementId)) {
          BeanFormReader subVoReader = new BeanFormReader((FormWidget) element);
          beanMapper.setBeanFieldValue(vo, elementId, subVoReader.getBean(beanMapper.getBeanFieldType(elementId)));
        }
      }
    }

  }
View Full Code Here

Examples of org.araneaframework.backend.util.BeanMapper

  private BeanMapper beanMapper;
  private Class beanClass;
 
  public BeanFormWidget(Class beanClass) {
    this.beanClass = beanClass;
    this.beanMapper = new BeanMapper(beanClass);
  }
View Full Code Here

Examples of org.araneaframework.backend.util.BeanMapper

  /**
   * Creates new instance of the GeneralVO.
   */
  protected BaseBean() {
    beanMapper = new BeanMapper(getClass());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.