Modifier and Type | Field and Description |
---|---|
static String |
COUNT_GENDERS
Specifies the
String that represents the NamedQuery to create a TypedQuery to count the
number of people of a specific gender. |
static String |
FIND_ALL
|
static String |
FIND_FIRST
Specifies the
String that represents the NamedQuery to create a TypedQuery to get the
first person in the database. |
Constructor and Description |
---|
Person() |
Modifier and Type | Method and Description |
---|---|
Birth |
getBirth()
Returns the birth record for this person.
|
Burial |
getBurial()
Returns the burial record for this person.
|
List<Person> |
getChildren()
Returns the list of all children for this person.
|
List<Person> |
getChildren(Person spouse)
Returns a list of all children of this person whose other parent is the specified spouse.
|
List<Person> |
getChildrenNoSpouse()
Returns a list of all children of this person whose other parent is unknown.
|
Death |
getDeath()
Returns the death record for this person.
|
Person |
getFather()
Returns the father of this person.
|
Gender |
getGender()
Returns the gender of this person.
|
int |
getId()
Returns the database primary key for this person.
|
Person |
getMother()
Returns the mother of this person.
|
String |
getName()
Returns the name of this person.
|
List<Person> |
getSpouses()
Returns the list of known spouses of this person.
|
boolean |
hasFather()
Returns
true if this person has a father, false otherwise. |
boolean |
hasMother()
Returns
true if this person has a mother, false otherwise. |
boolean |
hasParent()
Returns
true if this person has at least one parent, false otherwise. |
boolean |
hasParents()
Returns
true if this person has both parents, false otherwise. |
void |
setBirth(Birth birth)
Sets the birth record for this person.
|
void |
setBurial(Burial burial)
Sets the burial record for this person.
|
void |
setChildren(List<Person> children)
Sets the list of all children for this person.
|
void |
setDeath(Death death)
Sets the death record for this person.
|
void |
setFather(Person father)
Sets the father of this person.
|
void |
setGender(Gender gender)
Sets the gender of this person.
|
void |
setId(int id)
Sets the database primary key for this person.
|
void |
setMother(Person mother)
Sets the mother of this person.
|
void |
setName(String name)
Sets the name of this person
|
void |
setSpouses(List<Person> spouses)
Sets the list of known spouses of this person.
|
String |
toString()
Returns a string representation of the person, which is just the person's name.
|
public static final String COUNT_GENDERS
String
that represents the NamedQuery
to create a TypedQuery
to count the
number of people of a specific gender.
For example:
TypedQuery<Person> query = em.createNamedQuery(Person.COUNT_GENDERS, Person.class);
public static final String FIND_ALL
String
that represents the NamedQuery
to create a TypedQuery
to get all
people.
For example:
TypedQuery<Person> query = em.createNamedQuery(Person.FIND_ALL, Person.class);
query.setParameter("gender", gender);}
public static final String FIND_FIRST
String
that represents the NamedQuery
to create a TypedQuery
to get the
first person in the database.
For example:
TypedQuery<Person> query = em.createNamedQuery(Person.FIND_FIRST, Person.class);
public Birth getBirth()
public void setBirth(Birth birth)
birth.setPerson(this)
).birth
- the birth record for this personpublic Burial getBurial()
public void setBurial(Burial burial)
burial.setPerson(this)
).burial
- the burial record for this personpublic List<Person> getChildren()
public void setChildren(List<Person> children)
children
- the list of all children for this personpublic List<Person> getChildren(Person spouse)
spouse
- the other parentpublic List<Person> getChildrenNoSpouse()
public Death getDeath()
public void setDeath(Death death)
death.setPerson(this)
).death
- the death record for this personpublic Person getFather()
public void setFather(Person father)
father
- the father of this personpublic Gender getGender()
public void setGender(Gender gender)
gender
- the gender of this personpublic int getId()
public void setId(int id)
id
- the database primary key for this personpublic Person getMother()
public void setMother(Person mother)
mother
- the mother of this personpublic String getName()
public void setName(String name)
name
- the name of this personpublic List<Person> getSpouses()
public void setSpouses(List<Person> spouses)
spouses
- the list of known spouses of this personpublic boolean hasFather()
true
if this person has a father, false
otherwise.true
if this person has a father, false
otherwisepublic boolean hasMother()
true
if this person has a mother, false
otherwise.true
if this person has a mother, false
otherwisepublic boolean hasParent()
true
if this person has at least one parent, false
otherwise. This is done simply by
or-ing hasFather()
and hasMother()
: return hasFather() || hasMother();
.true
if this person has at least one parent, false
otherwisepublic boolean hasParents()
true
if this person has both parents, false
otherwise. This is done simply by and-ing
hasFather()
and hasMother()
: return hasFather() && hasMother();
.true
if this person has both parents, false
otherwiseCopyright © 2015 Joseph Hendrix