@Entity @Status(stage=TEST, unitTests=PARTIAL) public class Planet extends AbstractAuditTrailEntityIdentifiedById implements Serializable
Constructor and Description |
---|
Planet()
Default constructor as required by the JPA specs for unenhanced classes.
|
Planet(Long id,
String name)
Constructs this Planet from all the supplied, mandatory fields.
|
Planet(Long id,
String name,
Set<Moon> moons)
Constructs this Planet from all the supplied, mandatory fields.
|
Modifier and Type | Method and Description |
---|---|
void |
addMoon(Moon moon)
Adds the supplied Moon to this Planet.
|
Double |
getAphelion()
Gets the aphelion of this Planet in kilometers.
The aphelion is the smallest distance to the star this Planet belongs to. |
Double |
getGravity()
Gets the gravity of this Planet in meters per second2.
|
Double |
getMass()
Gets the mass of this Planet in kilograms.
|
Set<Moon> |
getMoons()
Gets all the Moons that orbit this Planet.
|
String |
getName()
Gets the name of this Planet.
|
Double |
getPerihelion()
Gets the perihelion of this Planet in kilometers.
The perihelion is the smallest distance to the star this Planet belongs to. |
Double |
getVolume()
Gets the volume of this Planet in cubic kilometers.
|
void |
setAphelion(Double aphelion)
Sets the aphelion for this Planet in kilometers.
The aphelion is the smallest distance to the star this Planet belongs to. |
void |
setGravity(Double gravity)
Sets the gravity for this Planet in meters per second2.
|
void |
setMass(Double mass)
Sets the mass for this Planet in kilograms.
|
void |
setMoons(Set<Moon> moons)
Sets all the Moons that orbit this Planet.
|
void |
setName(String name)
Sets the name for this Planet.
|
void |
setPerihelion(Double perihelion)
Sets the perihelion for this Planet in kilometers.
The perihelion is the smallest distance to the star this Planet belongs to. |
void |
setVolume(Double volume)
Sets the volume for this Planet in cubic kilometers.
|
String |
toString()
Creates a String representation of this Planet.
|
getAuditTrailData, setAuditTrailData
getId, getPrimaryKey, setId
equals, getVersion, hashCode, setVersion
public Planet()
public Planet(Long id, String name)
id
- Id of this Planet.name
- Name of this Planet.public Planet(Long id, String name, Set<Moon> moons)
id
- Id of this Planet.name
- Name of this Planet.moons
- The Moons that Orbit this Planet.NullPointerException
- When the supplied moons is null.public String getName()
public void setName(String name)
name
- The name for this Planet.public Double getPerihelion()
public void setPerihelion(Double perihelion)
perihelion
- The perihelion for this Planet in kilometers.public Double getAphelion()
public void setAphelion(Double aphelion)
aphelion
- The aphelion for this Planet in kilometers.public Double getVolume()
public void setVolume(Double volume)
volume
- The volume for this Planet in cubic kilometers.public Double getMass()
public void setMass(Double mass)
mass
- The mass for this Planet in kilograms.public Double getGravity()
public void setGravity(Double gravity)
gravity
- The gravity for this Planet in meters per second
2.public Set<Moon> getMoons()
public void setMoons(Set<Moon> moons)
moons
- The Moons that orbit this Planet.public void addMoon(Moon moon)
moon
- The Moon to add to this Planet.public String toString()
toString
in class AbstractEntityIdentifiedById
Copyright © 2008–2018. All rights reserved.