Class Objective

java.lang.Object
fr.utc.miage.sporttrack.entity.event.Objective

@Entity public class Objective extends Object
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 Details

    • Objective

      public Objective()
      No-argument constructor required by JPA.
    • Objective

      public Objective(String name, String description)
      Constructs a new objective with the specified name and description.
      Parameters:
      name - the display name of the objective; must not be null
      description - the textual description of the objective
      Throws:
      NullPointerException - if name is null
  • Method Details

    • getName

      public String getName()
      Returns the display name of this objective.
      Returns:
      the objective name
    • getDescription

      public String getDescription()
      Returns the textual description of this objective.
      Returns:
      the objective description
    • setDescription

      public void setDescription(String description)
      Sets the textual description of this objective.
      Parameters:
      description - the description to assign
    • setName

      public void setName(String name)
      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

      public Athlete getUser()
      Returns the athlete who owns this objective.
      Returns:
      the owning Athlete
    • setAthlete

      public void setAthlete(Athlete athlete)
      Sets the athlete who owns this objective.
      Parameters:
      athlete - the owning Athlete to assign
    • setSport

      public void setSport(Sport sport)
      Sets the sport associated with this objective.
      Parameters:
      sport - the Sport to associate
    • getSport

      public Sport getSport()
      Returns the sport associated with this objective.
      Returns:
      the associated Sport
    • isCompleted

      public boolean isCompleted()
      Returns whether this objective has been completed.
      Returns:
      true if completed, false otherwise
    • getCompletedAt

      public LocalDateTime getCompletedAt()
      Returns the timestamp at which this objective was completed.
      Returns:
      the completion timestamp, or null if not yet completed
    • setCompleted

      public void setCompleted(boolean completed)
      Sets whether this objective has been completed.
      Parameters:
      completed - true to mark as completed, false otherwise
    • setCompletedAt

      public void setCompletedAt(LocalDateTime completedAt)
      Sets the timestamp at which this objective was completed.
      Parameters:
      completedAt - the completion timestamp to assign