Class Objective
java.lang.Object
fr.utc.miage.sporttrack.entity.event.Objective
JPA entity representing a personal objective set by an athlete within the
SportTrack application.
An objective defines a measurable goal associated with a specific sport (e.g., "Run 50 km this month"). The athlete can mark the objective as completed once the target has been reached, at which point a completion timestamp is recorded.
- Author:
- SportTrack Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the timestamp at which this objective was completed.Returns the textual description of this objective.intgetId()Returns the unique identifier of this objective.getName()Returns the display name of this objective.getSport()Returns the sport associated with this objective.getUser()Returns the athlete who owns this objective.booleanReturns whether this objective has been completed.voidsetAthlete(Athlete athlete) Sets the athlete who owns this objective.voidsetCompleted(boolean completed) Sets whether this objective has been completed.voidsetCompletedAt(LocalDateTime completedAt) Sets the timestamp at which this objective was completed.voidsetDescription(String description) Sets the textual description of this objective.voidSets the display name of this objective.voidSets the sport associated with this objective.
-
Constructor Details
-
Objective
public Objective()No-argument constructor required by JPA. -
Objective
Constructs a new objective with the specified name and description.- Parameters:
name- the display name of the objective; must not benulldescription- the textual description of the objective- Throws:
NullPointerException- ifnameisnull
-
-
Method Details
-
getName
Returns the display name of this objective.- Returns:
- the objective name
-
getDescription
Returns the textual description of this objective.- Returns:
- the objective description
-
setDescription
Sets the textual description of this objective.- Parameters:
description- the description to assign
-
setName
Sets the display name of this objective.- Parameters:
name- the objective name to assign
-
getId
public int getId()Returns the unique identifier of this objective.- Returns:
- the objective's database identifier
-
getUser
Returns the athlete who owns this objective.- Returns:
- the owning
Athlete
-
setAthlete
Sets the athlete who owns this objective.- Parameters:
athlete- the owningAthleteto assign
-
setSport
Sets the sport associated with this objective.- Parameters:
sport- theSportto associate
-
getSport
Returns the sport associated with this objective.- Returns:
- the associated
Sport
-
isCompleted
public boolean isCompleted()Returns whether this objective has been completed.- Returns:
trueif completed,falseotherwise
-
getCompletedAt
Returns the timestamp at which this objective was completed.- Returns:
- the completion timestamp, or
nullif not yet completed
-
setCompleted
public void setCompleted(boolean completed) Sets whether this objective has been completed.- Parameters:
completed-trueto mark as completed,falseotherwise
-
setCompletedAt
Sets the timestamp at which this objective was completed.- Parameters:
completedAt- the completion timestamp to assign
-