Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value Objects

Status
Not open for further replies.

db2sachin

Programmer
Jun 9, 2003
24
0
0
AU
Is it ok to initialize an attribute (Addresses) of a Value Object while declaring that attribute.
eg Suppose I define a value object named Customer like this

public class Customer implements Serializable
{
private String firstName;
private String lastName;
private Collection Addresses = new ArrayList();

public Collection getAddresses()
{
return Addresses;
}
public String getFirstName()
{
return firstName;
}
public String getLastName()
{
return lastName;
}
public void setAddresses(Collection addresses)
{
Addresses = addresses;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
public void setLastName(String lastName)
{
this.lastName = lastName;
}
}

Is this correct or shall I use constructor to explicetly initialize my attribute Addresses with ArrayList ?
 
It really does not matter either way IMO.





--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top