FileDocCategorySizeDatePackage
SimplePropertyExample.javaAPI DocExample1834Wed May 18 09:38:58 BST 2005com.discursive.jccook.bean

SimplePropertyExample

public class SimplePropertyExample extends Object

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

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

		
		// Create an author
		Author wolfe = new Author( "Tom Wolfe", "Green" );
		
		try {
			String name = (String) PropertyUtils.getSimpleProperty( wolfe, "name" );
			String favoriteColor = (String) PropertyUtils.getSimpleProperty( wolfe, "favoriteColor" );
			
			System.out.println( "The Author has some properties: " + name + ", " + favoriteColor );
		} catch (IllegalAccessException e) {
			System.out.println( "You are not allowed to access a property!" );
		} catch (InvocationTargetException e) {
			System.out.println( "There was a problem invoking the method." );
		} catch (NoSuchMethodException e) {
			System.out.println( "The is no method to get a property." );
		}