Java Code Examples for org.springframework.beans.BeanUtils

Following code examples demonstrate how to use org.springframework.beans.BeanUtilsfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.beans.BeanUtilsand various code implementation of this class.

    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
        TestBeanUtilsObject testBeanUtilsObject1_a = new TestBeanUtilsObject();
        testBeanUtilsObject1_a.setName("aaa");
        TestBeanUtilsObject testBeanUtilsObject1_b = new TestBeanUtilsObject();
        org.springframework.beans.BeanUtils.copyProperties(testBeanUtilsObject1_a, testBeanUtilsObject1_b);
        System.out.println(testBeanUtilsObject1_b);

        TestBeanUtilsObject testBeanUtilsObject2_a = new TestBeanUtilsObject();
        testBeanUtilsObject2_a.setName("bbb");
        TestBeanUtilsObject testBeanUtilsObject2_b = new TestBeanUtilsObject();
        org.apache.commons.beanutils.BeanUtils.copyProperties(testBeanUtilsObject2_b,  testBeanUtilsObject2_a);
        System.out.println(testBeanUtilsObject2_b);
    } 


Advertisement
Javadoc
Static convenience methods for JavaBeans: for instantiating beans, checking bean property types, cop

ying bean properties, etc.

Mainly for use within the framework, but to some degree also useful for application classes. @author Rod Johnson @author Juergen Hoeller @author Rob Harrop @author Sam Brannen @author Sebastien Deleuze

Read More
Advertisement