---
title: "初用apache.commons.beanutils.BeanUtils"
author: "liqiupeng19840929"
date: "2007-11-30T16:14:06Z"
tags: ["Apache", "Java"]
slug: "apache-commons-beanutils-beanutils"
draft: false
lastmod: "2007-11-30T16:14:06Z"
id: 145136
url: "https://liqiupeng.iteye.com/blog/145136"
---

该class提供了一系列的静态方法操作业已存在的符合JavaBean规范定义的Java Class.这里强调的JavaBean规范,简单来说就是一个Java Class通过一系列getter和setter的方法向外界展示其内在的成员变量(属性).通过BeanUtils的静态方法,我们可以:

- 复制一个JavaBean的实例--BeanUtils.cloneBean();
- 在一个JavaBean的两个实例之间复制属性--BeanUtils.copyProperties(),BeanUtils.copyProperty();
- 为一个JavaBean的实例设置成员变量(属性)值--BeanUtils.populate(),BeanUtils.setProperty();
- 从一个一个JavaBean的实例中读取成员变量(属性)的值--BeanUtils.getArrayProperty(),BeanUtils.getIndexedProperty(),BeanUtils.getMappedProperty(),BeanUtils.getNestedProperty(),BeanUtils.getSimpleProperty(),BeanUtils.getProperty(),BeanUtils.describe();

       总的来看BeanUtils类提供了两大类的功能:读,写成员变量.