Package org.apache.commons.beanutils

Examples of org.apache.commons.beanutils.PropertyUtilsBean


    @Test
    public void testDigester()
        throws IOException, SAXException
    {
        PropertyUtilsBean propertyUtils = new MyPropertyUtilsBean();
        ConvertUtilsBean convertUtils = new ConvertUtilsBean();
        BeanUtilsBean beanUtils = new BeanUtilsBean( convertUtils, propertyUtils );
        BeanUtilsBean.setInstance( beanUtils );

        final String xml = "<myclass flag='true' />";
View Full Code Here


     */
    private static List<String> getJPACopierFields(Object bean)
            throws IllegalAccessException, NoSuchMethodException,
            InvocationTargetException {

        PropertyUtilsBean propertyUtilsBean =
                BeanUtilsBean.getInstance().getPropertyUtils();

        List<String> properties = Lists.newCopyOnWriteArrayList();

        // TODO: replace HibernateProxyHelper as its being phased out
        Class noProxyBean =
                HibernateProxyHelper.getClassWithoutInitializingProxy(bean);

        Map<String, Object> propertiesMap = propertyUtilsBean.describe(bean);

        for (String property : propertiesMap.keySet()) {
            // Read annotate in Field or Getter method of property
            try {
                PropertyDescriptor descriptor = propertyUtilsBean
                        .getPropertyDescriptor(bean, property);

                String methodName =
                        propertyUtilsBean.getReadMethod(descriptor).getName();

                Method getterMethod = noProxyBean.getMethod(methodName);
                if (isUseJPACopier(getterMethod)) {
                    properties.add(property);
                    continue;
View Full Code Here

            // instance is null for anonymous class, use default type
          }
        } catch (NoSuchFieldException e1) {
            try {
                BeanUtilsBean beanUtilsBean = BeanUtilsBean.getInstance();
                PropertyUtilsBean propertyUtils = beanUtilsBean.getPropertyUtils();
                return propertyUtils.getPropertyType(instance, propertyName);                   
            } catch (Exception e2) {
                // nothing
            }
        } catch (Exception e) {
          // ignore other exceptions
View Full Code Here

            if (log.isTraceEnabled())
                log.trace(bean.getClass().getName() + ": getting property '" + property + "' for column " + column.getName());
            */
           
            // Get Property Value
            PropertyUtilsBean pub = BeanUtilsBean.getInstance().getPropertyUtils();
            Object value = pub.getSimpleProperty(bean, property);

            // Now, set the record value
            setValue( column, value );

        } catch (IllegalAccessException e)
View Full Code Here

            throw new InvalidArgumentException("bean", bean);
        if (property==null)
            throw new InvalidArgumentException("property", 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 + "'");
            throw new BeanPropertyGetException(bean, property, e);
        } catch (InvocationTargetException e)
View Full Code Here

        cub.register(new IntegerArrayConverter(), Integer[].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

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.