Apache Jakarta and Beyond: A Java Programmeramp;#039;s Introduction [Electronic resources]

Larne Pekowsky

نسخه متنی -صفحه : 207/ 60
نمايش فراداده

8.2. Simple Properties

The heart of BeanUtils is a class called PropertyUtils, which provides a variety of static methods for getting and setting properties. The simplest usage gets a property such as a single string, integer, or object. For example, the call to get the name of an artist is

PropertyUtils.getSimpleProperty(artist, "name");

It is just as easy to set an artist's name

PropertyUtils.setSimpleProperty(artist, "name",
"the new name");