Org.apache.commons.beanutils - Tools for Javabean

xiaoxiao2021-03-06  39

Org.apache.commons.beanutils is a sub-project under Apache's Commons, because tracking Struts reasons, in-depth tracking this package, found that some of the static tool functions provided by the beanutils class are still very good. This toolkit is used in a large number of Struts for operating the ACTIONFORM object of Struts.

Clonebean: Copy a bean object. Use the REFLECT mode to call getter and setter to copy the bean object, which is equally valid for Bean objects that do not implement Clone methods.

CopyProperties: Copy source bean's same name property to the same name property of the target bean. Only two beans's same name properties are copied, so these two beans can be the same type, integrated relationship, or completely unrelated, as long as there are some names of the same Getter and Setter properties, they can be copied.

Describe: Let the names and values ​​of the attributes of a bean object to a Map object. Very used method. Its specific matters are called

Java.beans.beaninfo.getpropertyDescriptors () method.

GetProperty: Get its property value based on the attribute name of the bean object.

These methods are flexible, which can greatly save the complexity of the Bean object.

转载请注明原文地址:https://www.9cbs.com/read-71460.html

New Post(0)