Package org.araneaframework.backend.util

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


   * @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

   * 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

   *
   * @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

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

  /**
   * Creates new instance of the GeneralVO.
   */
  protected BaseBean() {
    beanMapper = new BeanMapper(getClass());
  }
View Full Code Here

  public ListItemsData getListItemsData(Class beanClass) throws SQLException,
  InstantiationException, IllegalAccessException {
    ListItemsData result = new ListItemsData();
    result.setTotalCount(this.totalCount);
   
    this.beanMapper = new BeanMapper(beanClass);
   
    List itemRange = new ArrayList();
    //XXX add capacity
   
    while (this.itemRangeResultSet.next()) {
View Full Code Here

  private Boolean booleanValue;
  private Long longValue;
  private TestVO subTestVO;

  public TestVO() {
    voMapper = new BeanMapper(getClass());
  }
View Full Code Here

  private BeanMapper mapper;

  private Object bean;

  public BeanVariableResolver(Class clazz) {
    this.mapper = new BeanMapper(clazz);
  }
View Full Code Here

  private Boolean booleanValue;
  private Long longValue;
  private TestVO subTestVO;

  public TestVO() {
    beanMapper = new BeanMapper(getClass());
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.backend.util.BeanMapper

Copyright © 2018 www.massapicom. 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.