com.gargoylesoftware.base.testing

Class SampleBean

public class SampleBean extends Object implements Serializable

A simple bean class that can be used for testing purposes. All properties fire PropertyChangeEvents when changed.

Version: $Revision: 1.3 $

Author: Mike Bowler

Field Summary
intage_
Stringname_
PropertyChangeSupportpropertyChangeSupport_
static longserialVersionUID
Constructor Summary
SampleBean()
Create a new instance.
SampleBean(String name, int age)
Create a new instance.
Method Summary
voidaddPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener
protected voidassertNotNull(String fieldName, Object fieldValue)
Verify that the specified value is not null.
intgetAge()
Return the age.
StringgetName()
Return the name.
voidremovePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener
voidsetAge(int age)
Set the age.
voidsetName(String name)
Set the name.

Field Detail

age_

private int age_

name_

private String name_

propertyChangeSupport_

private final PropertyChangeSupport propertyChangeSupport_

serialVersionUID

private static final long serialVersionUID

Constructor Detail

SampleBean

public SampleBean()
Create a new instance.

SampleBean

public SampleBean(String name, int age)
Create a new instance.

Parameters: name The name. age The age.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener

Parameters: listener The listener

assertNotNull

protected final void assertNotNull(String fieldName, Object fieldValue)
Verify that the specified value is not null. If it is then throw an exception

Parameters: fieldName The name of the field to check fieldValue The value of the field to check

Throws: DetailedNullPointerException If fieldValue is null

getAge

public int getAge()
Return the age.

Returns: The age.

getName

public String getName()
Return the name.

Returns: The name

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener

Parameters: listener The listener

setAge

public void setAge(int age)
Set the age.

Parameters: age The new age.

setName

public void setName(String name)
Set the name.

Parameters: name The new name.