Package org.apache.commons.beanutils

Examples of org.apache.commons.beanutils.PropertyUtilsBean


    if (bean == null) {
      return Collections.emptyMap();
    }
    Map<String, Object> result = null;
    try {
      result = new PropertyUtilsBean().describe(bean);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e);
    } catch (NoSuchMethodException e) {
View Full Code Here


      return Collections.emptyMap();
    }
   
    final Map<String, Entry<Class<?>, Object>> result = new HashMap<String, Entry<Class<?>, Object>>();
   
    final PropertyDescriptor[] descriptors = new PropertyUtilsBean().getPropertyDescriptors(clazz);
    for (final PropertyDescriptor descriptor : descriptors) {
      if (descriptor.getReadMethod() != null) {
        final String name = descriptor.getName();
        final Class<?> returnType = descriptor.getReadMethod().getReturnType();
        final Object propertyValue = getProperty(bean, name);
View Full Code Here

   * @return the property value.
   */
  public static Object getProperty(final Object bean, final String name) {
    Object result = null;
    try {
      result = new PropertyUtilsBean().getProperty(bean, name);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e);
    } catch (NoSuchMethodException e) {
View Full Code Here

     * @return the {@code BeanUtilsBean} instance to be used for all property
     *         set operations
     */
    private static BeanUtilsBean initBeanUtilsBean()
    {
        PropertyUtilsBean propUtilsBean = new PropertyUtilsBean();
        propUtilsBean.addBeanIntrospector(new FluentPropertyBeanIntrospector());
        return new BeanUtilsBean(new ConvertUtilsBean(), propUtilsBean);
    }
View Full Code Here

    protected Object getBeanPropertyValue(Object bean, String property)
    {
        try
        { // Get Property Value
            PropertyUtilsBean pub = BeanUtilsBean.getInstance().getPropertyUtils();
            return pub.getSimpleProperty(bean, property);

        }
        catch (IllegalAccessException e)
        {
            log.error(bean.getClass().getName() + ": unable to get property '" + property + "'");
View Full Code Here

    {

        Map actualParent;
        try
        {
            actualParent = (Map) new PropertyUtilsBean().getProperty(parent, fieldName);
            Object newValue = valueClass.newInstance();
            Object key = ConvertUtils.convertTo(keyValue, keyClass);
            actualParent.put(key, newValue);
            processPojoAnnotations(newValue, key, parent);
            return newValue;
View Full Code Here

        }
        else
        {
            try
            {
                new PropertyUtilsBean().setProperty(parent, fieldName, value);
            }
            catch (IllegalAccessException e)
            {
                throw new RuntimeException(e);
            }
View Full Code Here

        cub.register(new RelaxedStringArrayConverter(), String[].class);

        // BigDecimal, BigInteger, Class, Date, String, Time, TimeStamp
        // do not use defaults in the default configuration of ConvertUtilsBean

        return new BeanUtilsBean(cub, new PropertyUtilsBean());
    }
View Full Code Here

            if (log.isTraceEnabled())
                log.trace(bean.getClass().getName() + ": setting property '" + property + "' to " + String.valueOf(value));
            */
           
            // Get Property Value
            PropertyUtilsBean pub = BeanUtilsBean.getInstance().getPropertyUtils();
            return pub.getSimpleProperty(bean, property);
           
            // Check result
            /*
             * String res = BeanUtils.getProperty(bean, property); if (res!=value && res.equals(String.valueOf(value))==false) { //
             * Property value cannot be set // (missing setter?) String msg = bean.getClass().getName() + ": unable to set
View Full Code Here

    private PropertyUtilsBean pub;

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        pub = new PropertyUtilsBean();
        pub.addBeanIntrospector(new FluentPropertyBeanIntrospector());
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.beanutils.PropertyUtilsBean

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.