Package org.apache.commons.beanutils

Examples of org.apache.commons.beanutils.ConvertUtilsBean.convert()


      type = Class.forName(field.getType());
      List<T> rs = CollectUtils.newArrayList();
      if (properties.isEmpty()) {
        ConvertUtilsBean converter = Converter.getDefault();
        for (String data : datas) {
          rs.add((T) converter.convert(data, type));
        }
        return rs;
      } else {
        properties.clear();
        int startIndex=0;
View Full Code Here


                        }
                    }
                    val = defaultValue;
                }
                try {
                    Object convertedValue = convertUtilsBean.convert(val, m.getParameterTypes()[0]);
                    m.invoke(o, convertedValue);
                } catch (Exception ex) {
                    throw new LumifyException("Could not set property " + m.getName() + " on " + o.getClass().getName());
                }
            }
View Full Code Here

  @Test
  public void testPaddedInt() throws Exception
  {
    ConvertUtilsBean convertUtils = new ConvertUtilsBean();
    Integer intValue = (Integer)convertUtils.convert("456", int.class);

    assertEquals("correct int value", 456, intValue.intValue());
    BeanUtilsBean beanUtils = new BeanUtilsBean();
    PropertyDescriptor propDesc = beanUtils.getPropertyUtils().getPropertyDescriptor(_configBuilder,
                                                                                     "intSetting");
View Full Code Here

    if (StringUtils.isEmpty(source)) { return Collections.emptyList(); }
    String[] datas = StrUtils.split(source);
    List<T> rs = CollectUtils.newArrayList();
    ConvertUtilsBean converter = Converter.getDefault();
    for (String data : datas) {
      rs.add((T) converter.convert(data, type));
    }
    return rs;
  }

  public String asString(List<?> objects) {
View Full Code Here

      type = Class.forName(property.getValueType());
      List<T> rs = CollectUtils.newArrayList();
      if (properties.isEmpty()) {
        ConvertUtilsBean converter = Converter.getDefault();
        for (String data : datas) {
          rs.add((T) converter.convert(data, type));
        }
        return rs;
      } else {
        properties.clear();
        int startIndex = 0;
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.