Package relations
Class Deity
- java.lang.Object
-
- relations.Deity
-
- All Implemented Interfaces:
java.io.Serializable
@Entity public class Deity extends java.lang.Object implements java.io.SerializableAn entity that contains relations corresponding to family tree relations. This entity demonstrates the following JPA features: 1. Enum fields (gender) 2. @OneToOne relations 3. @OneToMany relations 4. Named queries- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDeity.Gender
-
Constructor Summary
Constructors Constructor Description Deity(java.lang.String name, Deity.Gender gender)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<Deity>getChildren()DeitygetFather()Deity.GendergetGender()DeitygetMother()java.lang.StringgetName()DeitygiveBirth(java.lang.String childName, Deity childFather, Deity.Gender gender)She's having a baby...voidsetChildren(java.util.Set<Deity> children)voidsetFather(Deity father)voidsetGender(Deity.Gender gender)voidsetMother(Deity mother)voidsetName(java.lang.String name)
-
-
-
Constructor Detail
-
Deity
public Deity(java.lang.String name, Deity.Gender gender)
-
-
Method Detail
-
giveBirth
public Deity giveBirth(java.lang.String childName, Deity childFather, Deity.Gender gender)
She's having a baby...- Parameters:
childName- the baby name- Returns:
- the new child
- Throws:
java.lang.IllegalArgumentException- if the person is not a woman, or if the person is unmarried (illegitimate children are not yet supported)
-
setName
public void setName(java.lang.String name)
-
getName
public java.lang.String getName()
-
setGender
public void setGender(Deity.Gender gender)
-
getGender
public Deity.Gender getGender()
-
setMother
public void setMother(Deity mother)
-
getMother
public Deity getMother()
-
setFather
public void setFather(Deity father)
-
getFather
public Deity getFather()
-
setChildren
public void setChildren(java.util.Set<Deity> children)
-
getChildren
public java.util.Set<Deity> getChildren()
-
-