Class Course

java.lang.Object
org.codewithmagret.rest.course.Course

@Entity public class Course extends Object
Represents a course that students can enroll in. Each course belongs to one category and is taught by one instructor. A course can have many students enrolled in it. This entity is used to manage the courses offered in the system, allowing students to browse and enroll in courses based on their interests and needs.
  • Constructor Details

    • Course

      public Course()
      Default constructor required by JPA. Initializes a new instance of the Course class.
    • Course

      public Course(String title, String code, Category category, Instructor instructor)
      Constructs a new Course with the specified title, code, category, and instructor.
      Parameters:
      title - the title of the course
      code - the unique code for the course
      category - the category to which the course belongs
      instructor - the instructor teaching the course
  • Method Details

    • getId

      public Long getId()
      Gets the unique identifier of the course.
      Returns:
      the ID of the course
    • setId

      public void setId(Long id)
      Sets the unique identifier of the course.
      Parameters:
      id - the ID to set for the course
    • getTitle

      public String getTitle()
      Gets the title of the course.
      Returns:
      the title of the course
    • setTitle

      public void setTitle(String title)
      Sets the title of the course.
      Parameters:
      title - the title to set for the course
    • getCode

      public String getCode()
      Gets the unique code of the course.
      Returns:
      the code of the course
    • setCode

      public void setCode(String code)
      Sets the unique code of the course.
      Parameters:
      code - the code to set for the course
    • getCategory

      public Category getCategory()
      Gets the category to which the course belongs.
      Returns:
      the category of the course
    • setCategory

      public void setCategory(Category category)
      Sets the category to which the course belongs.
      Parameters:
      category - the category to set for the course
    • getInstructor

      public Instructor getInstructor()
      Gets the instructor teaching the course.
      Returns:
      the instructor of the course
    • setInstructor

      public void setInstructor(Instructor instructor)
      Sets the instructor teaching the course.
      Parameters:
      instructor - the instructor to set for the course
    • getStudents

      public List<Student> getStudents()
      Gets the list of students enrolled in the course.
      Returns:
      the list of students in the course
    • setStudents

      public void setStudents(List<Student> students)
      Sets the list of students enrolled in the course.
      Parameters:
      students - the list of students to set for the course