firstName = firstName;
this.lastName = lastName;
this.dateOfBirth = dateOfBirth;
this.occupation = occupation;
}
public String getFirstName()
{
return firstName;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
public String getLastName()
{
return lastName;
}
public void setLastName(String lastName)
{
this.lastName = lastName;
}
public Date getDateOfBirth()
{
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth)
{
Chapter 4
[ 83 ]
this.dateOfBirth = dateOfBirth;
}
public Occupation getOccupation()
{
return occupation;
}
public void setOccupation(Occupation occupation)
{
this.occupation = occupation;
}
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
}
The Celebrity class is very simple. It basically contains five pieces of
information??”first name, last name, date of birth, occupation and a unique ID.
Later we can add more properties if we need them. For an occupation, it will make
sense to use an enumeration, perhaps as simple as this:
package com.packtpub.celebrities.model;
public enum Occupation
{
ACTOR, ACTRESS, ARTIST, BUSINESSMAN, COMPOSER,
MUSICIAN, POLITICIAN, SCIENTIST, SINGER, WRITER
}
If required, we can add any other occupation.
Pages:
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119