SourceForge.net Logo
Version: 0.27 - Last update: 2004-05-30 Home Page - SourceForge Project Page - Contact

Jodd
  Overview
  News
  Download
  License
  References

Development
  Using Jodd
  Javadoc
  JUnit report

Community
  Contribute
  Report a bug

More reading
  Milestone 0.30



Top 25%

BSD
 

Manage properties

Jodds bean package contains utilities for setting and getting the values of java bean properties.

Usage is simple and intuitive. BeanUtil.setProperty sets specified java bean property. Logic behind this method is quite user-friendly. For example, if property that has to be set is an Integer, provided bean value may be any Integer-compatible object.

 
BeanUtil.setProperty(fb, "foo", new Integer(1));// set integer
BeanUtil.setProperty(fb, "foo", null);		// null value
BeanUtil.setProperty(fb, "foo", "2");		// from string

Getting a property value is also simple:

 
i = (Integer) BeanUtil.getProperty(fb, "foo");	// get integer

All this is quite common for a bean library. Only one thing has to be emphasized: BeanUtil.setProperty doesn't throw an Exception on failure. Instead, method returns false. It seems that this reduce the amount of code when multiple properties of a bean are set at once and yet is possible to find what set failed, if needed.


http://jodd.sourceforge.net
najgor at users.sourceforge.net