[ 
https://issues.apache.org/jira/browse/BEANUTILS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16986872#comment-16986872
 ] 

Melloware commented on BEANUTILS-524:
-------------------------------------

>From looking at BeanUtilsBean it has overloaded constructors that take 
>ConvertUtils and PropertyUtils.

```java
/**
     * <p>Constructs an instance using given property and conversion 
instances.</p>
     *
     * @param convertUtilsBean use this {@code ConvertUtilsBean}
     * to perform conversions from one object to another
     * @param propertyUtilsBean use this {@code PropertyUtilsBean}
     * to access properties
     */
    public BeanUtilsBean(
                            final ConvertUtilsBean convertUtilsBean,
                            final PropertyUtilsBean propertyUtilsBean) {

        this.convertUtilsBean = convertUtilsBean;
        this.propertyUtilsBean = propertyUtilsBean;
    }
```

If you don't specify these you get the default.  You could makea new 
CopyUtilsBean and allow it to be inserted in the BeanutilsBean.  By default the 
CopyUtils will be the current BU verson.  However in BULL you could create your 
own CopyUtilsBean that does it the BULL way and then just instantiate 
BeanUtilsBean with your version like...

/**
     * <p>Constructs an instance using given property and conversion 
instances.</p>
     *
     * @param convertUtilsBean use this {@code ConvertUtilsBean}
     * to perform conversions from one object to another
     * @param propertyUtilsBean use this {@code PropertyUtilsBean}
     * to access properties
     */
    public BeanUtilsBean(
                            final ConvertUtilsBean convertUtilsBean,
                            final PropertyUtilsBean propertyUtilsBean
                             final CopyUtilsBean copyUtilsBean) {

        this.convertUtilsBean = convertUtilsBean;
        this.propertyUtilsBean = propertyUtilsBean;
        this.copyUtilsBean= copyUtilsBean; 
    }
```

Just a thought...  That way BULL code stays in BULL but gives you a hook for 
injecting your own copy in there.


> Make BeanUtils copyProperties able to copy Immutable, Mutable and Mixed Java 
> Bean
> ---------------------------------------------------------------------------------
>
>                 Key: BEANUTILS-524
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-524
>             Project: Commons BeanUtils
>          Issue Type: New Feature
>          Components: Locale BeanUtils / Converters
>            Reporter: Fabio Borriello
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> h4. Overview
> the copyProperties method in the BeanUtils class, is able to copy only public 
> properties or the ones with a public setter method.
> it would be really useful if this functionality can be extended in order to 
> copy any kind of Java Bean: Mutable, Immutable, Mixed.
> h4. Solution 
> Evaluate  the possibility to use, behind the scenes, an open source library 
> that is able to copy Mutable, Immutable and Mixed Java Bean. The library In 
> object is [BULL|https://github.com/HotelsDotCom/bull]. 
> This would also make able to copy nested objects.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to