Org. Apache. commons. beanutils-Tools for operating JavaBean

Source: Internet
Author: User
Org. apache. commons. beanutils is a sub-project under Apache commons. Because of tracking struts, we tracked this package in depth and found that some static tool functions provided by the beanutils class are still very useful. This toolkit is widely used in struts to operate the struts actionform object.

Clonebean: copy a bean object. The reflect method is used to call getter and setter to copy bean objects, which is equally effective for bean objects that do not implement the clone method.

Copyproperties: copy the Same Name attribute of the source bean to the same name attribute of the target bean. Only duplicate attributes with the same name of two beans, so the two beans can be of the same type, integration relationship, or completely irrelevant. As long as there are some attributes with the same name, getter and setter can both be copied.

Describe: Put the names and values of all attributes of a bean object in a map object and return them. Very useful method. The specific procedure is to callJava. Beans. beaninfo. getpropertydescriptors ()Method.

Getproperty: obtains the property value of a bean object based on its property name.

These methods can be used flexibly to greatly reduce the complexity of bean objects.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.