FileDocCategorySizeDatePackage
NestedPropertyExample.javaAPI DocExample1672Wed May 18 09:38:58 BST 2005com.discursive.jccook.bean

NestedPropertyExample

public class NestedPropertyExample extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		NestedPropertyExample example = new NestedPropertyExample();
		example.start();
	
private voidstart()

		
		// Create an author
		Author wolfe = new Author( "Tom Wolfe", "Green" );
		Book theRightStuff = new Book( "The Right Stuff", wolfe );
		
		try {
			String bookName = (String) PropertyUtils.getSimpleProperty( theRightStuff, "name" );
			String authorName = (String) PropertyUtils.getNestedProperty( theRightStuff, "author.name" );
			
			System.out.println( "The book is " + bookName );
			System.out.println( "The author is " + authorName );
		} catch (Exception e) {
			System.out.println( "There was a problem getting a bean property." );
			e.printStackTrace();
		}